Socket
Socket
Sign inDemoInstall

parse-duration

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-duration - npm Package Compare versions

Comparing version 0.4.4 to 0.5.0

11

index.js
'use strict'
var duration = /(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([a-zµμ]*)/ig
var durationRE = /(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([a-zµμ]*)/ig

@@ -22,3 +22,4 @@ module.exports = parse

parse.millisecond =
parse.ms = 1
parse.ms =
parse[''] = 1

@@ -62,5 +63,5 @@ parse.second =

var result = null
// ignore commas
str = str.replace(/(\d),(\d)/g, '$1$2')
str.replace(duration, function(_, n, units){
// ignore commas/placeholders
str = (str+'').replace(/(\d)[,_](\d)/g, '$1$2')
str.replace(durationRE, function(_, n, units){
units = parse[units] || parse[units.toLowerCase().replace(/s$/, '')]

@@ -67,0 +68,0 @@ if (units) result = (result || 0) + parseFloat(n, 10) * units

{
"name": "parse-duration",
"version": "0.4.4",
"version": "0.5.0",
"description": "convert a human readable duration string to a duration format",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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