Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sindresorhus/to-milliseconds

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sindresorhus/to-milliseconds

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

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59K
decreased by-3.26%
Maintainers
1
Weekly downloads
 
Created
Source

to-milliseconds

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

Install

$ npm install @sindresorhus/to-milliseconds

Usage

import toMilliseconds from '@sindresorhus/to-milliseconds';

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

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

API

toMilliseconds(timeDescriptor)

timeDescriptor

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

Keywords

FAQs

Package last updated on 21 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc