human-to-milliseconds

Human Interval to Milliseconds

This package contains very few lines of code. If you want to use this functionality, just copy it over.
Last updated 5 years ago by hacdias .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install human-to-milliseconds 
SYNC missed versions from official npm registry.

human-to-milliseconds

npm Travis

Converts human intervals to milliseconds. This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are: "ns", "us" (or "µs"), "ms", "s", "m", "h".

Install

In Node.js through npm

$ npm install --save human-to-milliseconds

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact an ES5 transpiled version with the right shims added. This means that you can require it and use with your favorite bundler without having to adjust asset management process.

const HumanToMilliseconds = require('human-to-milliseconds')

In the Browser through <script> tag

Loading this module through a script tag will make the HumanToMilliseconds obj available in the global namespace.

<script src="https://unpkg.com/human-to-milliseconds/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/human-to-milliseconds/dist/index.js"></script>

API

try {
  console.log(HumanToMilliseconds('1h50m'))
} catch (err) {
  console.log(err)
}

Current Tags

  • 2.0.0                                ...           latest (5 years ago)

2 Versions

  • 2.0.0 [deprecated]           ...           5 years ago
  • 1.0.0 [deprecated]           ...           7 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE