timecop
v0.0.1
Published
Simple parsing of written durations
Downloads
7
Readme
timecop
Simple parsing of written durations
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