Skip to content

Commit

Permalink
GH-455 - Parse upper and lower into numbers to appropriately test the…
Browse files Browse the repository at this point in the history
…ir ranges.

Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
  • Loading branch information
ncb000gt committed Jan 24, 2020
1 parent 3a6f2ec commit 672668e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,14 @@
for (var i = 0; i < allRanges.length; i++) {
if (allRanges[i].match(rangePattern)) {
allRanges[i].replace(rangePattern, function($0, lower, upper, step) {
const wasStepDefined = !isNaN(parseInt(step));
lower = parseInt(lower, 10);
upper = parseInt(upper, 10) || undefined;

const wasStepDefined = !isNaN(parseInt(step, 10));
if (step === '0') {
throw new Error('Field (' + field + ') has a step of zero');
}
step = parseInt(step) || 1;
step = parseInt(step, 10) || 1;

if (upper && lower > upper) {
throw new Error('Field (' + field + ') has an invalid range');
Expand Down

0 comments on commit 672668e

Please sign in to comment.