npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

timecop

0.0.1 • Public • Published

timecop

Simple parsing of written durations

Build Status

example

var timecop = require('../index.js');
 
var duration = timecop('Every 2 seconds and 300 milliseconds').milliseconds();
 
var interval = setInterval(function() {
  console.log('I am logging every 2.3 seconds');
}, duration);

timecop checks for milliseconds, seconds, minutes, hours, days and weeks

timecop('1 week, 2 days, 3 hours, 4 minutes, 5 seconds and 6 milliseconds');

and outputs to any of those same units

var duration = timecop('2 days');
 
duration.milliseconds(); // 172800000
duration.seconds(); // 172800
duration.minutes(); // 2880
duration.hours(); // 48
duration.days(); // 2
duration.weeks(); // 0.29

install

With npm do:

npm install timecop

license

MIT

Keywords

none

install

npm i timecop

Downloadsweekly downloads

22

version

0.0.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability