time-f
v0.0.1
Published
This repository is a template of the npm package.
Downloads
3
Readme
time-f
This library provides a function.The function, time()
, converts arguments into a time based value.
Usage
const time = require('time-f');
const str = '1h 15m';
const time1 = time(str);
const time2 = time(1, 15, 0);
console.log(time1); // 4.5e+6 milliseconds
console.log(time2); // 4.5e+6 milliseconds
For example, time()
can be used in setInterval()
.
setInterval(f, time('5sec'));
Compared with 5000
, time('5sec')
is human-readable.