xen-orchestra/@vates/parse-duration
2021-05-05 09:51:44 +02:00
..
.npmignore feat: unified .npmignore for all packages 2021-04-07 13:58:14 +02:00
index.js fix(parse-duration): show original value in error message 2021-05-05 09:48:30 +02:00
package.json feat(@vates/parse-duration): 0.1.1 2021-05-05 09:51:44 +02:00
README.md fix(parse-duration): ISC license 2021-05-05 09:49:50 +02:00
USAGE.md feat(@vates/parse-duration): 0.1.0 2020-06-12 11:02:42 +02:00

@vates/parse-duration

Package Version License PackagePhobia Node compatibility

Small wrapper around ms to parse a duration

Install

Installation of the npm package:

> npm install --save @vates/parse-duration

Usage

ms without magic: always parse a duration and throws if invalid.

import { parseDuration } from '@vates/parse-duration'

parseDuration('2 days')
// 172800000

parseDuration(172800000)
// 172800000

parseDuration(undefined)
// throws TypeError('not a valid duration: undefined')

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Vates SAS