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

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.2.1 to 0.3.0

7

index.js

@@ -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
```
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