@vates/parse-duration

0.1.1 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @vates/parse-duration

Weekly Downloads

31

Version

0.1.1

License

ISC

Unpacked Size

2.35 kB

Total Files

3

Last publish

Collaborators

  • mlssfrncjrg
  • b-nollet
  • arnogues
  • florent.beauchamp
  • mathieura
  • enishowk
  • tgoettelmann
  • julien-f
  • marsaud
  • olivierlambert
  • pdonias