Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

to-ms

1.2.0 • Public • Published

toMs ⏲

A simple and human-friendly millisecond conversion util with awesome chaining.

Install

npm install to-ms
// or
yarn add to-ms

Examples

var toMs = require('to-ms');
 
setTimeout(
  function () {
    /* do something */
  }, toMs
    .hour(1)
    .minutes(15)
    .seconds(30)
);

Chaining

All methods are chainable, and easy to use.

var ms = toMs
  .days(30)
  .hours(10)
  .minutes(30)
  .seconds(45);

Browser Support

Just use window.toMs. To support legacy browsers you must use ES5-Shim.

Methods

  • toMs.second()
  • toMs.seconds(Number)
  • toMs.minute()
  • toMs.minutes(Number)
  • toMs.hour()
  • toMs.hours(Number)
  • toMs.day()
  • toMs.days(Number)
  • toMs.week()
  • toMs.weeks(Number)
  • toMs.year()
  • toMs.years(Number)

Acknowledgements

This package was previously owned and maintained by Shuvalov Anton.

Install

npm i to-ms

DownloadsWeekly Downloads

6

Version

1.2.0

License

MIT

Unpacked Size

9.32 kB

Total Files

11

Last publish

Collaborators

  • avatar