JSPM

@sindresorhus/to-milliseconds

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 72987
  • Score
    100M100P100Q161193F
  • License MIT

Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`

Package Exports

  • @sindresorhus/to-milliseconds

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sindresorhus/to-milliseconds) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

to-milliseconds Build Status

Convert an object of time properties to milliseconds: {seconds: 2}2000

Install

$ npm install @sindresorhus/to-milliseconds

Usage

const toMilliseconds = require('@sindresorhus/to-milliseconds');

toMilliseconds({
    days: 15,
    hours: 11,
    minutes: 23,
    seconds: 20,
    milliseconds: 1
});
//=> 1337000001

setTimeout(() => {
    // …
}, toMilliseconds({minutes: 2}));

API

toMilliseconds(input)

input

Type: Object

Specify an object with any of the following properties:

  • days
  • hours
  • minutes
  • seconds
  • milliseconds
  • microseconds
  • nanoseconds
  • parse-ms - The inverse of this module
  • pretty-ms - Convert milliseconds to a human readable string

License

MIT © Sindre Sorhus