Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #240. Edge case when dealing with multiple ranges for one parameter of the cron input #241

Merged
merged 3 commits into from Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/convert-expression/range-conversion.js
Expand Up @@ -15,7 +15,7 @@ module.exports = ( () => {
numbers.push(i);
}

return expression.replace(new RegExp(text, 'gi'), numbers.join());
return expression.replace(new RegExp(text, 'i'), numbers.join());
}

function convertRange(expression){
Expand Down
6 changes: 6 additions & 0 deletions test/convert-expression/range-conversion-test.js
Expand Up @@ -15,4 +15,10 @@ describe('range-conversion.js', () => {
const expression = conversion(expressions).join(' ');
expect(expression).to.equal('0,1,2,3 0,1,2,3 8,9,10 1,2,3 1,2 0,1,2,3');
});

it('should convert comma delimited ranges to numbers', () => {
var expressions = '0-2,10-23'.split(' ');
var expression = conversion(expressions).join(' ');
expect(expression).to.equal('0,1,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23');
});
});