Converts human readable expression to a cron string!
If you can interpert 0 */1 * * *
as each minute
then this module is not for you ;)
human-to-cron
parsers the human readable expressions with the help of ES6 generators converts it into a cron string.
Get it: npm install --save human-to-cron
Sample usage:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| var humanToCron = require('human-to-cron');
humanToCron('once each minute') // => 0 */1 * * * *
humanToCron('each 2 minutes') // => * */2 * * * *
humanToCron('each second') // => */1 * * * * *
humanToCron('once each hour') // => 0 0 */1 * * *
humanToCron('once each day') // => 0 0 0 */1 * *
humanToCron('once each month') // => 0 0 0 0 */1 *
humanToCron('once each 5 months') // => 0 0 0 0 */5 *
humanToCron('midnight') // => 0 0 0 * * *
humanToCron('midnight each 2 minutes') // => 0 */2 0 * * *
humanToCron('once tuesday each 10 minutes') // => 0 */10 * 1 * *
humanToCron('friday 15:44') // => 0 44 15 4 * *
humanToCron('august friday 15:44') // => 0 44 15 4 7 *
|
GIF FTW!
Thanks to Andrius Skerla for this cheeky module!