parse-duration
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -0,1 +1,2 @@ | ||
'use strict' | ||
@@ -13,3 +14,3 @@ var duration = /(-?\d*\.?\d+(?:e[-+]?\d+)?)\s*([a-zμ]*)/ig | ||
parse.μs = | ||
parse['μs'] = | ||
parse.microsecond = 1 / 1e3 | ||
@@ -39,2 +40,3 @@ | ||
parse.b = | ||
parse.month = parse.d * (365.25 / 12) | ||
@@ -55,2 +57,4 @@ | ||
var result = 0 | ||
// ignore commas | ||
str = str.replace(/(\d),(\d)/g, '$1$2') | ||
str.replace(duration, function(_, n, units){ | ||
@@ -57,0 +61,0 @@ units = parse[units] |
{ | ||
"name": "parse-duration", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "convert a human readable duration string to ms", | ||
"keywords": ["parse","duration","time"], | ||
"keywords": [ | ||
"parse", | ||
"duration", | ||
"time" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"serve": "jkroso/serve", | ||
"jsmd": "*" | ||
"tape": "^4.8.0" | ||
}, | ||
"scripts": { | ||
"test": "node test" | ||
}, | ||
"repository": "git://github.com/jkroso/parse-duration.git", | ||
"bugs": "https://github.com/jkroso/parse-duration/issues", | ||
"author": "Jake Rosoman", | ||
"files": ["index.js"], | ||
"files": [ | ||
"index.js" | ||
], | ||
"license": "MIT" | ||
} |
# parse-duration | ||
# parse-duration ![travis](https://travis-ci.org/jkroso/parse-duration.svg?branch=master) | ||
@@ -8,8 +8,4 @@ convert a human readable duration to ms | ||
With your favourite package manager: | ||
`npm install parse-duration` | ||
- [packin](//github.com/jkroso/packin): `packin add parse-duration` | ||
- [component](//github.com/component/component#installing-packages): `component install jkroso/parse-duration` | ||
- [npm](//npmjs.org/doc/cli/npm-install.html): `npm install parse-duration` | ||
then in your app: | ||
@@ -51,2 +47,8 @@ | ||
comma seperated numbers | ||
```js | ||
parse('27,681 ns') // => 27681 * ns | ||
``` | ||
And most other types of noise | ||
@@ -53,0 +55,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4140
1
5
49
84
1