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

millisecond

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

millisecond - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

42

index.js

@@ -0,1 +1,33 @@

'use strict';
var regex = new RegExp('^((?:\\d+)?\\.?\\d+) *('+ [
'milliseconds?',
'msecs?',
'ms',
'seconds?',
'secs?',
's',
'minutes?',
'mins?',
'm',
'hours?',
'hrs?',
'h',
'days?',
'd',
'weeks?',
'wks?',
'w',
'years?',
'yrs?',
'y'
].join('|') +')?$', 'i');
var second = 1000
, minute = second * 60
, hour = minute * 60
, day = hour * 24
, week = day * 7
, year = day * 365;
/**

@@ -9,13 +41,5 @@ * Parse a time string and return the number value of it.

module.exports = function millisecond(ms) {
'use strict';
if ('string' !== typeof ms || '0' === ms || +ms) return +ms;
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|wks?|w|years?|yrs?|y)?$/i.exec(ms)
, second = 1000
, minute = second * 60
, hour = minute * 60
, day = hour * 24
, week = day * 7
, year = day * 365
var match = regex.exec(ms)
, amount;

@@ -22,0 +46,0 @@

{
"name": "millisecond",
"version": "0.1.0",
"version": "0.1.1",
"description": "Convert time strings to milliseconds",

@@ -5,0 +5,0 @@ "main": "index.js",

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