Socket
Socket
Sign inDemoInstall

cronstrue

Package Overview
Dependencies
0
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.3 to 0.10.7

3

dist/cronstrue.js

@@ -390,2 +390,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

}
if (hour === 0) {
hour = 12;
}
}

@@ -392,0 +395,0 @@ var minute = minuteExpression;

2

dist/cronstrue.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cronstrue",[],t):"object"==typeof exports?exports.cronstrue=t():e.cronstrue=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(1),o=function(){function e(t,n){this.expression=t,this.options=n,this.expressionParts=new Array(5),e.locales[n.locale]?this.i18n=e.locales[n.locale]:(console.warn("Locale '"+n.locale+"' could not be found; falling back to 'en'."),this.i18n=e.locales.en),void 0===n.use24HourTimeFormat&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=void 0===n?{}:n,i=r.throwExceptionOnParseError,o=void 0===i||i,s=r.verbose,a=void 0!==s&&s,u=r.dayOfWeekStartIndexZero,c=void 0===u||u,p=r.use24HourTimeFormat,f=r.locale;return new e(t,{throwExceptionOnParseError:o,verbose:a,dayOfWeekStartIndexZero:c,use24HourTimeFormat:p,locale:void 0===f?"en":f}).getFullDescription()},e.initialize=function(t){e.specialCharacters=["/","-",",","*"],t.load(e.locales)},e.prototype.getFullDescription=function(){var e="";try{var t=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero);this.expressionParts=t.parse();var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),o=this.getMonthDescription(),s=this.getDayOfWeekDescription(),a=this.getYearDescription();e+=n+r+s+o+a,e=this.transformVerbosity(e,this.options.verbose),e=e.charAt(0).toLocaleUpperCase()+e.substr(1)}catch(t){if(this.options.throwExceptionOnParseError)throw""+t;e=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD()}return e},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],o="";if(r.StringUtilities.containsAny(n,e.specialCharacters)||r.StringUtilities.containsAny(i,e.specialCharacters)||r.StringUtilities.containsAny(t,e.specialCharacters))if(!(n.indexOf("-")>-1)||n.indexOf(",")>-1||r.StringUtilities.containsAny(i,e.specialCharacters))if(i.indexOf(",")>-1&&i.indexOf("-")==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(",");o+=this.i18n.at();for(var a=0;a<s.length;a++)o+=" ",o+=this.formatTime(s[a],n,""),a<s.length-2&&(o+=","),a==s.length-2&&(o+=this.i18n.spaceAnd())}else{var u=this.getSecondsDescription(),c=this.getMinutesDescription(),p=this.getHoursDescription();o+=u,o.length>0&&(o+=", "),o+=c,o.length>0&&(o+=", "),o+=p}else{var f=n.split("-");o+=r.StringUtilities.format(this.i18n.everyMinutebetweenX0AndX1(),this.formatTime(i,f[0],""),this.formatTime(i,f[1],""))}else o+=this.i18n.atSpace()+this.formatTime(i,n,t);return o},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everysecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return"0"==t?"":parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute():e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute()})},e.prototype.getMinutesDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(t){try{return"0"==t?"":parseInt(t)<20?e.i18n.atX0MinutesPastTheHour():e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour()}catch(t){return e.i18n.atX0MinutesPastTheHour()}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2];return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){return e.formatTime(t,"0","")},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek();return"*"==this.expressionParts[5]&&"*"!=this.expressionParts[3]?"":this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(e){var n=e;return e.indexOf("#")>-1?n=e.substr(0,e.indexOf("#")):e.indexOf("L")>-1&&(n=n.replace("L","")),t[parseInt(n)]},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0daysOfTheWeek(),t)},function(t){return e.i18n.commaX0ThroughX1()},function(t){var n=null;if(t.indexOf("#")>-1){var r=t.substring(t.indexOf("#")+1),i=null;switch(r){case"1":i=e.i18n.first();break;case"2":i=e.i18n.second();break;case"3":i=e.i18n.third();break;case"4":i=e.i18n.forth();break;case"5":i=e.i18n.fifth()}n=e.i18n.commaOnThe()+i+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf("L")>-1?e.i18n.commaOnTheLastX0OfTheMonth():e.i18n.commaOnlyOnX0();return n})},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],"",function(e){return t[parseInt(e)-1]},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Months(),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case"L":t=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var o=parseInt(i[0].replace("W","")),s=1==o?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),o.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),s);break}t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(e){return e},function(t){return"1"==t?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days()},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth()},function(t){return e.i18n.commaOnDayX0OfTheMonth()})}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],"",function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,o,s){var a=this,u=null;if(e)if("*"===e)u=t;else if(r.StringUtilities.containsAny(e,["/","-",","]))if(e.indexOf("/")>-1){var c=e.split("/");if(u=r.StringUtilities.format(i(c[1]),n(c[1])),c[0].indexOf("-")>-1){var p=this.generateBetweenSegmentDescription(c[0],o,n);0!=p.indexOf(", ")&&(u+=", "),u+=p}else if(!r.StringUtilities.containsAny(c[0],["*",","])){var f=r.StringUtilities.format(s(c[0]),n(c[0]));f=f.replace(", ",""),u+=r.StringUtilities.format(this.i18n.commaStartingX0(),f)}}else if(e.indexOf(",")>-1){for(var c=e.split(","),h="",y=0;y<c.length;y++)if(y>0&&c.length>2&&(h+=",",y<c.length-1&&(h+=" ")),y>0&&c.length>1&&(y==c.length-1||2==c.length)&&(h+=this.i18n.spaceAndSpace()),c[y].indexOf("-")>-1){var p=this.generateBetweenSegmentDescription(c[y],function(e){return a.i18n.commaX0ThroughX1()},n);p=p.replace(", ",""),h+=p}else h+=n(c[y]);u=r.StringUtilities.format(s(e),h)}else e.indexOf("-")>-1&&(u=this.generateBetweenSegmentDescription(e,o,n));else u=r.StringUtilities.format(s(e),n(e));else u="";return u},e.prototype.generateBetweenSegmentDescription=function(e,t,n){var i="",o=e.split("-"),s=n(o[0]),a=n(o[1]);a=a.replace(":00",":59");var u=t(e);return i+=r.StringUtilities.format(u,s,a)},e.prototype.formatTime=function(e,t,n){var r=parseInt(e),i="";this.options.use24HourTimeFormat||(i=r>=12?" PM":" AM",r>12&&(r-=12));var o=t,s="";return n&&(s=":"+("00"+n).substring(n.length)),("00"+r.toString()).substring(r.toString().length)+":"+("00"+o.toString()).substring(o.toString().length)+s+i},e.prototype.transformVerbosity=function(e,t){return t||(e=e.replace(new RegExp(this.i18n.commaEveryMinute(),"g"),""),e=e.replace(new RegExp(this.i18n.commaEveryHour(),"g"),""),e=e.replace(new RegExp(this.i18n.commaEveryDay(),"g"),"")),e},e}();o.locales={},t.ExpressionDescriptor=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){void 0===t&&(t=!0),this.expression=e,this.dayOfWeekStartIndexZero=t}return e.prototype.parse=function(){if(!this.expression)throw new Error("Expression is empty");var e=this.expression.trim().split(" ");if(e.length<5)throw new Error("Expression only has "+e.length+" parts. At least 5 part are required.");if(5==e.length)e.unshift(""),e.push("");else if(6==e.length)/\d{4}$/.test(e[5])?e.unshift(""):e.push("");else if(e.length>7)throw new Error("Expression has "+e.length+" parts; too many!");return this.normalizeExpression(e),e},e.prototype.normalizeExpression=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),0==e[0].indexOf("0/")&&(e[0]=e[0].replace("0/","*/")),0==e[1].indexOf("0/")&&(e[1]=e[1].replace("0/","*/")),0==e[2].indexOf("0/")&&(e[2]=e[2].replace("0/","*/")),0==e[3].indexOf("1/")&&(e[3]=e[3].replace("1/","*/")),0==e[4].indexOf("1/")&&(e[4]=e[4].replace("1/","*/")),0==e[5].indexOf("1/")&&(e[5]=e[5].replace("1/","*/")),0==e[6].indexOf("1/")&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#\/\s]\d)/g,function(e){var n=e.replace(/\D/,""),r=n;return t.dayOfWeekStartIndexZero?"7"==n&&(r="0"):r=(parseInt(n)-1).toString(),e.replace(n,r)}),"?"==e[3]&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,"g"),n[r].toString());var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var o in i)e[4]=e[4].replace(new RegExp(o,"g"),i[o].toString());"0"==e[0]&&(e[0]="");for(var s=0;s<e.length;s++)if("*/1"==e[s]&&(e[s]="*"),e[s].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[s])){var a=null;switch(s){case 4:a="12";break;case 5:a="6";break;case 6:a="9999";break;default:a=null}if(null!=a){var u=e[s].split("/");e[s]=u[0]+"-"+a+"/"+u[1]}}},e}();t.CronParser=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occured when generating the expression description. Check the cron expression syntax."},e.prototype.everyMinute=function(){return"every minute"},e.prototype.everyHour=function(){return"every hour"},e.prototype.atSpace=function(){return"At "},e.prototype.everyMinutebetweenX0AndX1=function(){return"Every minute between %s and %s"},e.prototype.at=function(){return"At"},e.prototype.spaceAnd=function(){return" and"},e.prototype.everysecond=function(){return"every second"},e.prototype.everyX0Seconds=function(){return"every %s seconds"},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},e.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},e.prototype.everyX0Minutes=function(){return"every %s minutes"},e.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},e.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},e.prototype.everyX0Hours=function(){return"every %s hours"},e.prototype.betweenX0AndX1=function(){return"between %s and %s"},e.prototype.atX0=function(){return"at %s"},e.prototype.commaEveryDay=function(){return", every day"},e.prototype.commaEveryX0daysOfTheWeek=function(){return", every %s days of the week"},e.prototype.commaX0ThroughX1=function(){return", %s through %s"},e.prototype.first=function(){return"first"},e.prototype.second=function(){return"second"},e.prototype.third=function(){return"third"},e.prototype.forth=function(){return"forth"},e.prototype.fifth=function(){return"fifth"},e.prototype.commaOnThe=function(){return", on the "},e.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},e.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},e.prototype.commaOnlyOnX0=function(){return", only on %s"},e.prototype.commaEveryX0Months=function(){return", every %s months"},e.prototype.commaOnlyInX0=function(){return", only in %s"},e.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},e.prototype.firstWeekday=function(){return"first weekday"},e.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},e.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},e.prototype.commaEveryX0Days=function(){return", every %s days"},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},e.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},e.prototype.spaceAndSpace=function(){return" and "},e.prototype.commaEveryMinute=function(){return", every minute"},e.prototype.commaEveryHour=function(){return", every hour"},e.prototype.commaEveryX0Years=function(){return", every %s years"},e.prototype.commaStartingX0=function(){return", starting %s"},e.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},e.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},e}();t.en=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.replace(/%s/g,function(){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}();t.StringUtilities=r},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),i=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}();t.enLocaleLoader=i},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(5);r.ExpressionDescriptor.initialize(new i.enLocaleLoader),t.default=r.ExpressionDescriptor;var o=r.ExpressionDescriptor.toString;t.toString=o}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cronstrue",[],t):"object"==typeof exports?exports.cronstrue=t():e.cronstrue=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(1),o=function(){function e(t,n){this.expression=t,this.options=n,this.expressionParts=new Array(5),e.locales[n.locale]?this.i18n=e.locales[n.locale]:(console.warn("Locale '"+n.locale+"' could not be found; falling back to 'en'."),this.i18n=e.locales.en),void 0===n.use24HourTimeFormat&&(n.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return e.toString=function(t,n){var r=void 0===n?{}:n,i=r.throwExceptionOnParseError,o=void 0===i||i,s=r.verbose,a=void 0!==s&&s,u=r.dayOfWeekStartIndexZero,c=void 0===u||u,p=r.use24HourTimeFormat,f=r.locale;return new e(t,{throwExceptionOnParseError:o,verbose:a,dayOfWeekStartIndexZero:c,use24HourTimeFormat:p,locale:void 0===f?"en":f}).getFullDescription()},e.initialize=function(t){e.specialCharacters=["/","-",",","*"],t.load(e.locales)},e.prototype.getFullDescription=function(){var e="";try{var t=new i.CronParser(this.expression,this.options.dayOfWeekStartIndexZero);this.expressionParts=t.parse();var n=this.getTimeOfDayDescription(),r=this.getDayOfMonthDescription(),o=this.getMonthDescription(),s=this.getDayOfWeekDescription(),a=this.getYearDescription();e+=n+r+s+o+a,e=this.transformVerbosity(e,this.options.verbose),e=e.charAt(0).toLocaleUpperCase()+e.substr(1)}catch(t){if(this.options.throwExceptionOnParseError)throw""+t;e=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD()}return e},e.prototype.getTimeOfDayDescription=function(){var t=this.expressionParts[0],n=this.expressionParts[1],i=this.expressionParts[2],o="";if(r.StringUtilities.containsAny(n,e.specialCharacters)||r.StringUtilities.containsAny(i,e.specialCharacters)||r.StringUtilities.containsAny(t,e.specialCharacters))if(!(n.indexOf("-")>-1)||n.indexOf(",")>-1||r.StringUtilities.containsAny(i,e.specialCharacters))if(i.indexOf(",")>-1&&i.indexOf("-")==-1&&!r.StringUtilities.containsAny(n,e.specialCharacters)){var s=i.split(",");o+=this.i18n.at();for(var a=0;a<s.length;a++)o+=" ",o+=this.formatTime(s[a],n,""),a<s.length-2&&(o+=","),a==s.length-2&&(o+=this.i18n.spaceAnd())}else{var u=this.getSecondsDescription(),c=this.getMinutesDescription(),p=this.getHoursDescription();o+=u,o.length>0&&(o+=", "),o+=c,o.length>0&&(o+=", "),o+=p}else{var f=n.split("-");o+=r.StringUtilities.format(this.i18n.everyMinutebetweenX0AndX1(),this.formatTime(i,f[0],""),this.formatTime(i,f[1],""))}else o+=this.i18n.atSpace()+this.formatTime(i,n,t);return o},e.prototype.getSecondsDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[0],this.i18n.everysecond(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Seconds(),t)},function(t){return e.i18n.secondsX0ThroughX1PastTheMinute()},function(t){return"0"==t?"":parseInt(t)<20?e.i18n.atX0SecondsPastTheMinute():e.i18n.atX0SecondsPastTheMinuteGt20()||e.i18n.atX0SecondsPastTheMinute()})},e.prototype.getMinutesDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(e){return e},function(t){return r.StringUtilities.format(e.i18n.everyX0Minutes(),t)},function(t){return e.i18n.minutesX0ThroughX1PastTheHour()},function(t){try{return"0"==t?"":parseInt(t)<20?e.i18n.atX0MinutesPastTheHour():e.i18n.atX0MinutesPastTheHourGt20()||e.i18n.atX0MinutesPastTheHour()}catch(t){return e.i18n.atX0MinutesPastTheHour()}})},e.prototype.getHoursDescription=function(){var e=this,t=this.expressionParts[2];return this.getSegmentDescription(t,this.i18n.everyHour(),function(t){return e.formatTime(t,"0","")},function(t){return r.StringUtilities.format(e.i18n.everyX0Hours(),t)},function(t){return e.i18n.betweenX0AndX1()},function(t){return e.i18n.atX0()})},e.prototype.getDayOfWeekDescription=function(){var e=this,t=this.i18n.daysOfTheWeek();return"*"==this.expressionParts[5]&&"*"!=this.expressionParts[3]?"":this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(e){var n=e;return e.indexOf("#")>-1?n=e.substr(0,e.indexOf("#")):e.indexOf("L")>-1&&(n=n.replace("L","")),t[parseInt(n)]},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0daysOfTheWeek(),t)},function(t){return e.i18n.commaX0ThroughX1()},function(t){var n=null;if(t.indexOf("#")>-1){var r=t.substring(t.indexOf("#")+1),i=null;switch(r){case"1":i=e.i18n.first();break;case"2":i=e.i18n.second();break;case"3":i=e.i18n.third();break;case"4":i=e.i18n.forth();break;case"5":i=e.i18n.fifth()}n=e.i18n.commaOnThe()+i+e.i18n.spaceX0OfTheMonth()}else n=t.indexOf("L")>-1?e.i18n.commaOnTheLastX0OfTheMonth():e.i18n.commaOnlyOnX0();return n})},e.prototype.getMonthDescription=function(){var e=this,t=this.i18n.monthsOfTheYear();return this.getSegmentDescription(this.expressionParts[4],"",function(e){return t[parseInt(e)-1]},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Months(),t)},function(t){return e.i18n.commaMonthX0ThroughMonthX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInX0()})},e.prototype.getDayOfMonthDescription=function(){var e=this,t=null,n=this.expressionParts[3];switch(n){case"L":t=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":t=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var i=n.match(/(\d{1,2}W)|(W\d{1,2})/);if(i){var o=parseInt(i[0].replace("W","")),s=1==o?this.i18n.firstWeekday():r.StringUtilities.format(this.i18n.weekdayNearestDayX0(),o.toString());t=r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),s);break}t=this.getSegmentDescription(n,this.i18n.commaEveryDay(),function(e){return e},function(t){return"1"==t?e.i18n.commaEveryDay():e.i18n.commaEveryX0Days()},function(t){return e.i18n.commaBetweenDayX0AndX1OfTheMonth()},function(t){return e.i18n.commaOnDayX0OfTheMonth()})}return t},e.prototype.getYearDescription=function(){var e=this;return this.getSegmentDescription(this.expressionParts[6],"",function(e){return/^\d+$/.test(e)?new Date(parseInt(e),1).getFullYear().toString():e},function(t){return r.StringUtilities.format(e.i18n.commaEveryX0Years(),t)},function(t){return e.i18n.commaYearX0ThroughYearX1()||e.i18n.commaX0ThroughX1()},function(t){return e.i18n.commaOnlyInX0()})},e.prototype.getSegmentDescription=function(e,t,n,i,o,s){var a=this,u=null;if(e)if("*"===e)u=t;else if(r.StringUtilities.containsAny(e,["/","-",","]))if(e.indexOf("/")>-1){var c=e.split("/");if(u=r.StringUtilities.format(i(c[1]),n(c[1])),c[0].indexOf("-")>-1){var p=this.generateBetweenSegmentDescription(c[0],o,n);0!=p.indexOf(", ")&&(u+=", "),u+=p}else if(!r.StringUtilities.containsAny(c[0],["*",","])){var f=r.StringUtilities.format(s(c[0]),n(c[0]));f=f.replace(", ",""),u+=r.StringUtilities.format(this.i18n.commaStartingX0(),f)}}else if(e.indexOf(",")>-1){for(var c=e.split(","),h="",y=0;y<c.length;y++)if(y>0&&c.length>2&&(h+=",",y<c.length-1&&(h+=" ")),y>0&&c.length>1&&(y==c.length-1||2==c.length)&&(h+=this.i18n.spaceAndSpace()),c[y].indexOf("-")>-1){var p=this.generateBetweenSegmentDescription(c[y],function(e){return a.i18n.commaX0ThroughX1()},n);p=p.replace(", ",""),h+=p}else h+=n(c[y]);u=r.StringUtilities.format(s(e),h)}else e.indexOf("-")>-1&&(u=this.generateBetweenSegmentDescription(e,o,n));else u=r.StringUtilities.format(s(e),n(e));else u="";return u},e.prototype.generateBetweenSegmentDescription=function(e,t,n){var i="",o=e.split("-"),s=n(o[0]),a=n(o[1]);a=a.replace(":00",":59");var u=t(e);return i+=r.StringUtilities.format(u,s,a)},e.prototype.formatTime=function(e,t,n){var r=parseInt(e),i="";this.options.use24HourTimeFormat||(i=r>=12?" PM":" AM",r>12&&(r-=12),0===r&&(r=12));var o=t,s="";return n&&(s=":"+("00"+n).substring(n.length)),("00"+r.toString()).substring(r.toString().length)+":"+("00"+o.toString()).substring(o.toString().length)+s+i},e.prototype.transformVerbosity=function(e,t){return t||(e=e.replace(new RegExp(this.i18n.commaEveryMinute(),"g"),""),e=e.replace(new RegExp(this.i18n.commaEveryHour(),"g"),""),e=e.replace(new RegExp(this.i18n.commaEveryDay(),"g"),"")),e},e}();o.locales={},t.ExpressionDescriptor=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){void 0===t&&(t=!0),this.expression=e,this.dayOfWeekStartIndexZero=t}return e.prototype.parse=function(){if(!this.expression)throw new Error("Expression is empty");var e=this.expression.trim().split(" ");if(e.length<5)throw new Error("Expression only has "+e.length+" parts. At least 5 part are required.");if(5==e.length)e.unshift(""),e.push("");else if(6==e.length)/\d{4}$/.test(e[5])?e.unshift(""):e.push("");else if(e.length>7)throw new Error("Expression has "+e.length+" parts; too many!");return this.normalizeExpression(e),e},e.prototype.normalizeExpression=function(e){var t=this;if(e[3]=e[3].replace("?","*"),e[5]=e[5].replace("?","*"),0==e[0].indexOf("0/")&&(e[0]=e[0].replace("0/","*/")),0==e[1].indexOf("0/")&&(e[1]=e[1].replace("0/","*/")),0==e[2].indexOf("0/")&&(e[2]=e[2].replace("0/","*/")),0==e[3].indexOf("1/")&&(e[3]=e[3].replace("1/","*/")),0==e[4].indexOf("1/")&&(e[4]=e[4].replace("1/","*/")),0==e[5].indexOf("1/")&&(e[5]=e[5].replace("1/","*/")),0==e[6].indexOf("1/")&&(e[6]=e[6].replace("1/","*/")),e[5]=e[5].replace(/(^\d)|([^#\/\s]\d)/g,function(e){var n=e.replace(/\D/,""),r=n;return t.dayOfWeekStartIndexZero?"7"==n&&(r="0"):r=(parseInt(n)-1).toString(),e.replace(n,r)}),"?"==e[3]&&(e[3]="*"),e[3].indexOf("W")>-1&&(e[3].indexOf(",")>-1||e[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var n={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var r in n)e[5]=e[5].replace(new RegExp(r,"g"),n[r].toString());var i={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var o in i)e[4]=e[4].replace(new RegExp(o,"g"),i[o].toString());"0"==e[0]&&(e[0]="");for(var s=0;s<e.length;s++)if("*/1"==e[s]&&(e[s]="*"),e[s].indexOf("/")>-1&&!/^\*|\-|\,/.test(e[s])){var a=null;switch(s){case 4:a="12";break;case 5:a="6";break;case 6:a="9999";break;default:a=null}if(null!=a){var u=e[s].split("/");e[s]=u[0]+"-"+a+"/"+u[1]}}},e}();t.CronParser=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},e.prototype.atX0MinutesPastTheHourGt20=function(){return null},e.prototype.commaMonthX0ThroughMonthX1=function(){return null},e.prototype.commaYearX0ThroughYearX1=function(){return null},e.prototype.use24HourTimeFormatByDefault=function(){return!1},e.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occured when generating the expression description. Check the cron expression syntax."},e.prototype.everyMinute=function(){return"every minute"},e.prototype.everyHour=function(){return"every hour"},e.prototype.atSpace=function(){return"At "},e.prototype.everyMinutebetweenX0AndX1=function(){return"Every minute between %s and %s"},e.prototype.at=function(){return"At"},e.prototype.spaceAnd=function(){return" and"},e.prototype.everysecond=function(){return"every second"},e.prototype.everyX0Seconds=function(){return"every %s seconds"},e.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},e.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},e.prototype.everyX0Minutes=function(){return"every %s minutes"},e.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},e.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},e.prototype.everyX0Hours=function(){return"every %s hours"},e.prototype.betweenX0AndX1=function(){return"between %s and %s"},e.prototype.atX0=function(){return"at %s"},e.prototype.commaEveryDay=function(){return", every day"},e.prototype.commaEveryX0daysOfTheWeek=function(){return", every %s days of the week"},e.prototype.commaX0ThroughX1=function(){return", %s through %s"},e.prototype.first=function(){return"first"},e.prototype.second=function(){return"second"},e.prototype.third=function(){return"third"},e.prototype.forth=function(){return"forth"},e.prototype.fifth=function(){return"fifth"},e.prototype.commaOnThe=function(){return", on the "},e.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},e.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},e.prototype.commaOnlyOnX0=function(){return", only on %s"},e.prototype.commaEveryX0Months=function(){return", every %s months"},e.prototype.commaOnlyInX0=function(){return", only in %s"},e.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},e.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},e.prototype.firstWeekday=function(){return"first weekday"},e.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},e.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},e.prototype.commaEveryX0Days=function(){return", every %s days"},e.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},e.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},e.prototype.spaceAndSpace=function(){return" and "},e.prototype.commaEveryMinute=function(){return", every minute"},e.prototype.commaEveryHour=function(){return", every hour"},e.prototype.commaEveryX0Years=function(){return", every %s years"},e.prototype.commaStartingX0=function(){return", starting %s"},e.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},e.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},e}();t.en=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.format=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.replace(/%s/g,function(){return t.shift()})},e.containsAny=function(e,t){return t.some(function(t){return e.indexOf(t)>-1})},e}();t.StringUtilities=r},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),i=function(){function e(){}return e.prototype.load=function(e){e.en=new r.en},e}();t.enLocaleLoader=i},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(5);r.ExpressionDescriptor.initialize(new i.enLocaleLoader),t.default=r.ExpressionDescriptor;var o=r.ExpressionDescriptor.toString;t.toString=o}])});
{
"name": "cronstrue",
"version": "0.10.3",
"title": "cRonstrue",
"version": "0.10.7",
"description": "Convert cron expressions into human readable descriptions",

@@ -10,3 +11,3 @@ "author": "Brady Holt",

},
"homepage": "https://github.com/bradyholt/cronstrue#readme",
"homepage": "https://github.com/bradyholt/cronstrue",
"keywords": [

@@ -52,4 +53,4 @@ "cron",

"scripts": {
"build": "tsc",
"pretest": "npm run build",
"start": "tsc",
"pretest": "npm start",
"test": "./node_modules/.bin/mocha --reporter spec",

@@ -56,0 +57,0 @@ "prerelease": "rm -rf ./dist && webpack && node ./docs/generate.js README.md && git add -A && git commit --allow-empty -m 'Build latest /dist'",

@@ -68,3 +68,3 @@ # cRonstrue [![Build Status](https://travis-ci.org/bradyholt/cRonstrue.svg?branch=master)](https://travis-ci.org/bradyholt/cRonstrue) [![NPM Package](https://img.shields.io/npm/v/cronstrue.svg)](https://www.npmjs.com/package/cronstrue)

A demo is available here: [http://bradyholt.github.io/cRonstrue/](http://bradyholt.github.io/cRonstrue/)
A demo is available here [here](http://bradyholt.github.io/cRonstrue/#cronstrue-demo).

@@ -71,0 +71,0 @@ ## i18n

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc