cron-validate
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -0,1 +1,8 @@ | ||
## [1.4.2](https://github.com/Airfooox/cron-validate/compare/v1.4.1...v1.4.2) (2020-12-25) | ||
### Bug Fixes | ||
* **deps:** update dependency yup to v0.32.8 ([#146](https://github.com/Airfooox/cron-validate/issues/146)) ([fc2783d](https://github.com/Airfooox/cron-validate/commit/fc2783dfbdf6488cded93d3e639519c9779b1fec)) | ||
## [1.4.1](https://github.com/Airfooox/cron-validate/compare/v1.4.0...v1.4.1) (2020-11-21) | ||
@@ -2,0 +9,0 @@ |
@@ -34,3 +34,3 @@ "use strict"; | ||
return result_1.err([ | ||
`Cannot specify last day of month with lists, or ranges (symbols ,/).` | ||
`Cannot specify last day of month with lists, or ranges (symbols ,/).`, | ||
]); | ||
@@ -42,3 +42,3 @@ } | ||
return result_1.err([ | ||
`Cannot specify nearest weekday with lists, steps or ranges (symbols ,-/).` | ||
`Cannot specify nearest weekday with lists, steps or ranges (symbols ,-/).`, | ||
]); | ||
@@ -45,0 +45,0 @@ } |
@@ -33,3 +33,3 @@ "use strict"; | ||
return result_1.err([ | ||
`Cannot specify last day of week with lists, steps or ranges (symbols ,-/).` | ||
`Cannot specify last day of week with lists, steps or ranges (symbols ,-/).`, | ||
]); | ||
@@ -41,3 +41,3 @@ } | ||
return result_1.err([ | ||
`Cannot specify Nth weekday of month with lists, steps or ranges (symbols ,-/).` | ||
`Cannot specify Nth weekday of month with lists, steps or ranges (symbols ,-/).`, | ||
]); | ||
@@ -44,0 +44,0 @@ } |
@@ -7,15 +7,29 @@ "use strict"; | ||
// e.g.: For AWS, sun = 1, while for normal cron, sun = 0. Translating to numbers would break that. | ||
const monthAliases = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; | ||
const monthAliases = [ | ||
'jan', | ||
'feb', | ||
'mar', | ||
'apr', | ||
'may', | ||
'jun', | ||
'jul', | ||
'aug', | ||
'sep', | ||
'oct', | ||
'nov', | ||
'dec', | ||
]; | ||
const daysOfWeekAliases = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; | ||
const checkWildcardLimit = (cronFieldType, options) => { | ||
return (options[cronFieldType].lowerLimit === | ||
options.preset[cronFieldType].minValue && | ||
options[cronFieldType].upperLimit === | ||
options.preset[cronFieldType].maxValue); | ||
}; | ||
const checkWildcardLimit = (cronFieldType, options) => (options[cronFieldType].lowerLimit === | ||
options.preset[cronFieldType].minValue && | ||
options[cronFieldType].upperLimit === options.preset[cronFieldType].maxValue); | ||
const checkSingleElementWithinLimits = (element, cronFieldType, options) => { | ||
if (cronFieldType === 'months' && options.useAliases && monthAliases.indexOf(element.toLowerCase()) !== -1) { | ||
if (cronFieldType === 'months' && | ||
options.useAliases && | ||
monthAliases.indexOf(element.toLowerCase()) !== -1) { | ||
return result_1.valid(true); | ||
} | ||
if (cronFieldType === 'daysOfWeek' && options.useAliases && daysOfWeekAliases.indexOf(element.toLowerCase()) !== -1) { | ||
if (cronFieldType === 'daysOfWeek' && | ||
options.useAliases && | ||
daysOfWeekAliases.indexOf(element.toLowerCase()) !== -1) { | ||
return result_1.valid(true); | ||
@@ -47,3 +61,5 @@ } | ||
} | ||
if (cronFieldType === 'daysOfMonth' && options.useLastDayOfMonth && element === 'L') { | ||
if (cronFieldType === 'daysOfMonth' && | ||
options.useLastDayOfMonth && | ||
element === 'L') { | ||
return result_1.valid(true); | ||
@@ -54,3 +70,5 @@ } | ||
// We use `endsWith` here because anywhere else is not valid so it will be caught later on. | ||
if (cronFieldType === 'daysOfWeek' && options.useLastDayOfWeek && element.endsWith('L')) { | ||
if (cronFieldType === 'daysOfWeek' && | ||
options.useLastDayOfWeek && | ||
element.endsWith('L')) { | ||
const day = element.slice(0, -1); | ||
@@ -66,3 +84,5 @@ if (day === '') { | ||
// We use `endsWith` here because anywhere else is not valid so it will be caught later on. | ||
if (cronFieldType === 'daysOfMonth' && options.useNearestWeekday && element.endsWith('W')) { | ||
if (cronFieldType === 'daysOfMonth' && | ||
options.useNearestWeekday && | ||
element.endsWith('W')) { | ||
const day = element.slice(0, -1); | ||
@@ -78,3 +98,5 @@ if (day === '') { | ||
} | ||
if (cronFieldType === 'daysOfWeek' && options.useNthWeekdayOfMonth && element.indexOf('#') !== -1) { | ||
if (cronFieldType === 'daysOfWeek' && | ||
options.useNthWeekdayOfMonth && | ||
element.indexOf('#') !== -1) { | ||
const [day, occurrence, ...leftOvers] = element.split('#'); | ||
@@ -81,0 +103,0 @@ if (leftOvers.length !== 0) { |
@@ -144,3 +144,3 @@ "use strict"; | ||
.required(); | ||
exports.getOptionPreset = (presetId) => { | ||
const getOptionPreset = (presetId) => { | ||
if (optionPresets[presetId]) { | ||
@@ -151,6 +151,6 @@ return result_1.valid(optionPresets[presetId]); | ||
}; | ||
exports.getOptionPresets = () => { | ||
return optionPresets; | ||
}; | ||
exports.registerOptionPreset = (presetName, preset) => { | ||
exports.getOptionPreset = getOptionPreset; | ||
const getOptionPresets = () => optionPresets; | ||
exports.getOptionPresets = getOptionPresets; | ||
const registerOptionPreset = (presetName, preset) => { | ||
optionPresets[presetName] = optionPresetSchema.validateSync(preset, { | ||
@@ -163,3 +163,4 @@ strict: false, | ||
}; | ||
exports.validateOptions = (inputOptions) => { | ||
exports.registerOptionPreset = registerOptionPreset; | ||
const validateOptions = (inputOptions) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; | ||
@@ -336,1 +337,2 @@ try { | ||
}; | ||
exports.validateOptions = validateOptions; |
@@ -31,4 +31,6 @@ "use strict"; | ||
exports.Err = exports.Valid = exports.err = exports.valid = void 0; | ||
exports.valid = (value) => new Valid(value); | ||
exports.err = (error) => new Err(error); | ||
const valid = (value) => new Valid(value); | ||
exports.valid = valid; | ||
const err = (error) => new Err(error); | ||
exports.err = err; | ||
class Valid { | ||
@@ -35,0 +37,0 @@ constructor(value) { |
{ | ||
"name": "cron-validate", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "cron-validate is a cron-expression validator written in TypeScript.", | ||
@@ -83,23 +83,23 @@ "scripts": { | ||
"@semantic-release/git": "9.0.0", | ||
"@types/jest": "26.0.15", | ||
"@types/node": "13.13.32", | ||
"@types/yup": "0.29.9", | ||
"@typescript-eslint/eslint-plugin": "4.8.1", | ||
"@typescript-eslint/parser": "4.8.1", | ||
"@types/jest": "26.0.19", | ||
"@types/node": "13.13.38", | ||
"@types/yup": "0.29.11", | ||
"@typescript-eslint/eslint-plugin": "4.11.0", | ||
"@typescript-eslint/parser": "4.11.0", | ||
"env-cmd": "10.1.0", | ||
"eslint": "7.14.0", | ||
"eslint": "7.16.0", | ||
"eslint-config-airbnb-base": "14.2.1", | ||
"eslint-config-prettier": "6.15.0", | ||
"eslint-config-prettier": "7.1.0", | ||
"eslint-plugin-import": "2.22.1", | ||
"jest": "26.6.3", | ||
"nodemon": "2.0.6", | ||
"prettier": "2.2.0", | ||
"semantic-release": "17.2.4", | ||
"prettier": "2.2.1", | ||
"semantic-release": "17.3.0", | ||
"ts-jest": "26.4.4", | ||
"ts-node": "9.0.0", | ||
"typescript": "4.1.2" | ||
"ts-node": "9.1.1", | ||
"typescript": "4.1.3" | ||
}, | ||
"dependencies": { | ||
"yup": "0.30.0" | ||
"yup": "0.32.8" | ||
} | ||
} |
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
66305
1149
+ Added@types/lodash@4.17.9(transitive)
+ Addednanoclone@0.2.1(transitive)
+ Addedyup@0.32.8(transitive)
- Removedyup@0.30.0(transitive)
Updatedyup@0.32.8