parse-duration
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -53,6 +53,8 @@ 'use strict' | ||
* @param {String} str | ||
* @param {String} format | ||
* @return {Number} | ||
*/ | ||
function parse(str){ | ||
function parse(str, format){ | ||
format = format || 'ms' | ||
var result = null | ||
@@ -65,3 +67,4 @@ // ignore commas | ||
}) | ||
return result | ||
return result && (result / parse[format]) | ||
} |
{ | ||
"name": "parse-duration", | ||
"version": "0.2.1", | ||
"description": "convert a human readable duration string to ms", | ||
"version": "0.3.0", | ||
"description": "convert a human readable duration string to a duration format", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "parse", |
@@ -84,1 +84,9 @@ | ||
And its easy to add more | ||
### parse(str, format) | ||
The output format can also be defined | ||
```js | ||
parse('1hr 20mins', 'm') // => 80 | ||
``` |
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
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
4448
52
92