* @param {string} expression The Cron-Job expression. * @param {number} min The minimum value. * @param {number} max The maximum value. * @returns {boolean}
(expression, min, max)
| 14 | * @returns {boolean} |
| 15 | */ |
| 16 | function isValidExpression(expression, min, max) { |
| 17 | const options = expression; |
| 18 | |
| 19 | for (const option of options) { |
| 20 | const optionAsInt = parseInt(option, 10); |
| 21 | |
| 22 | if ( |
| 23 | (!Number.isNaN(optionAsInt) && |
| 24 | (optionAsInt < min || optionAsInt > max)) || |
| 25 | !validationRegex.test(option) |
| 26 | ) |
| 27 | return false; |
| 28 | } |
| 29 | |
| 30 | return true; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @param {string} expression The Cron-Job expression. |
no outgoing calls
no test coverage detected