cron-expression-validator
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -0,1 +1,2 @@ | ||
// old recovery codes | ||
4af25157f045b70da192bdc00d104299fe44e0453c95bc8933bd5db90fe9d705 | ||
@@ -9,2 +10,12 @@ | ||
df71da3702ec0c18d48684e5d825928b8c4496e51104c187803bc80d6c2e9549 | ||
df71da3702ec0c18d48684e5d825928b8c4496e51104c187803bc80d6c2e9549 | ||
use google authontication app for 2FA authontication | ||
// new recovery codes 6/5/2021 | ||
d4f4eb8433ca26e43b57323d3c10ba20f4e3d37e552253512931f125475db921 | ||
cf20a40f59e9f93f9e01c1999abd2cceffcdf0d208d9f4a8d92f6c08cb411fe8 | ||
5200e9556269892387a8ed98b615158451319efb040da2240239f34bcc8f7833 | ||
878bd4238dbf5f3d806d91a76a24d52bb93322de911bd8a4f8ef871a0c7dee85 | ||
aa46b08ddd1b5bfde4b325c1f1d145c640784f99e2f0eb5a02620c296108aa0b |
29
index.js
@@ -252,3 +252,3 @@ const CONSTANTS = require('./constants'); | ||
} | ||
if(isNaN(parseInt(multiMonthArr[0])) && isValidateMonthStr(multiMonthArr, MONTH_LIST)) { | ||
if(isNaN(parseInt(multiMonthArr[0])) && !isValidateMonthStr(multiMonthArr, MONTH_LIST)) { | ||
isError = true; | ||
@@ -339,8 +339,22 @@ errorMsg.push(CONSTANTS.ERROR_MSGES.MONTH_LETTER_ERROR_MSG); | ||
} else if(time.includes('-')) { | ||
let secRangeArr = time.split('-'); | ||
if(!isValidateTime(secRangeArr, val)) { | ||
isError = true; | ||
errorMsg.push(CONSTANTS.ERROR_MSGES.TIME_ERROR_MSG); | ||
if(time.includes(',')) { | ||
let multiSecArr = time.split(','); | ||
let values = multiSecArr.filter(e => !e.includes('-')) | ||
let timegap = multiSecArr.filter(e=>e.includes('-')) | ||
let timegapArr = timegap.join('-').split('-') | ||
let combineArr = values.concat(timegapArr) | ||
if(!isValidateTime(combineArr, val)) { | ||
isError = true; | ||
errorMsg.push(CONSTANTS.ERROR_MSGES.TIME_ERROR_MSG); | ||
} | ||
return isValidateTime(combineArr, val); | ||
} else { | ||
let secRangeArr = time.split('-'); | ||
if(!isValidateTime(secRangeArr, val)) { | ||
isError = true; | ||
errorMsg.push(CONSTANTS.ERROR_MSGES.TIME_ERROR_MSG); | ||
} | ||
return isValidateTime(secRangeArr, val); | ||
} | ||
return isValidateTime(secRangeArr, val); | ||
} else if(time.includes(',')) { | ||
@@ -367,1 +381,4 @@ let multiSecArr = time.split(','); | ||
} | ||
a = this.isValidCronExpression('0/5 14,18,3-39,52 * ? JAN,MAR,SEP MON-FRI 2002-2010', {error: true}) | ||
console.log(a) |
{ | ||
"name": "cron-expression-validator", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "Validate cron expressions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,3 +70,3 @@ # cron-expression-validator | ||
## License | ||
MIT |
@@ -27,2 +27,3 @@ const expect = require('chai').expect; | ||
expect(index.isValidCronExpression('0 0 12 ? * L')).to.equal(true); | ||
expect(index.isValidCronExpression('0/5 14,18,3-39,52 * ? JAN,MAR,SEP MON-FRI 2002-2010')).to.equal(true); | ||
}); | ||
@@ -29,0 +30,0 @@ |
24778
409