cron-parser
Advanced tools
Comparing version 2.14.0 to 2.15.0
@@ -286,2 +286,5 @@ 'use strict'; | ||
if (atoms.length > 1) { | ||
if (atoms[0] == +atoms[0]) { | ||
atoms = [atoms[0] + '-' + constraints[1], atoms[1]]; | ||
} | ||
return parseRange(atoms[0], atoms[atoms.length - 1]); | ||
@@ -288,0 +291,0 @@ } |
{ | ||
"name": "cron-parser", | ||
"version": "2.14.0", | ||
"version": "2.15.0", | ||
"description": "Node.js library for parsing crontab instructions", | ||
@@ -5,0 +5,0 @@ "main": "lib/parser.js", |
@@ -286,2 +286,43 @@ var test = require('tap').test; | ||
test('range test with value and repeat (second)', function(t) { | ||
var options = { | ||
currentDate: new CronDate('Wed, 26 Dec 2012 14:38:53') | ||
}; | ||
var interval = CronExpression.parse('0/30 * * * * ?', options); | ||
t.ok(interval, 'Interval parsed'); | ||
var next = interval.next(); | ||
t.equal(next.getSeconds(), 0); | ||
next = interval.next(); | ||
t.equal(next.getSeconds(), 30); | ||
next = interval.next(); | ||
t.equal(next.getSeconds(), 0); | ||
t.end(); | ||
}); | ||
test('range test with value and repeat (minute)', function(t) { | ||
var options = { | ||
currentDate: new CronDate('Wed, 26 Dec 2012 14:38:53') | ||
}; | ||
var interval = CronExpression.parse('6/23 * * * *', options); | ||
t.ok(interval, 'Interval parsed'); | ||
var next = interval.next(); | ||
t.equal(next.getMinutes(), 52); | ||
next = interval.next(); | ||
t.equal(next.getMinutes(), 6); | ||
next = interval.next(); | ||
t.equal(next.getMinutes(), 29); | ||
next = interval.next(); | ||
t.equal(next.getMinutes(), 52); | ||
t.end(); | ||
}); | ||
test('range test with iterator', function(t) { | ||
@@ -973,3 +1014,6 @@ try { | ||
test('should sort ranges and values in ascending order', function(t) { | ||
var interval = CronExpression.parse('0 12,13,10,1-3 * * *'); | ||
var options = { | ||
currentDate: new CronDate('Wed, 26 Dec 2012 14:38:53') | ||
}; | ||
var interval = CronExpression.parse('0 12,13,10,1-3 * * *', options); | ||
t.ok(interval, 'Interval parsed'); | ||
@@ -976,0 +1020,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93483
2609