Socket
Socket
Sign inDemoInstall

cronstrue

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cronstrue - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

dist/i18n/locales/sv.d.ts

2

dist/cronstrue.js

@@ -474,3 +474,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

}
expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s]\d)+/g, function (t) {
expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s]\d)/g, function (t) {
var dowDigits = t.replace(/\D/, "");

@@ -477,0 +477,0 @@ var dowDigitsAdjusted = dowDigits;

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

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

@@ -8,2 +8,3 @@ export { en } from "./locales/en";

export { nb } from "./locales/nb";
export { sv } from "./locales/sv";
export { pl } from "./locales/pl";

@@ -10,0 +11,0 @@ export { pt_BR } from "./locales/pt_BR";

{
"name": "cronstrue",
"version": "0.8.0",
"version": "0.9.0",
"description": "Convert cron expressions into human readable descriptions",

@@ -5,0 +5,0 @@ "author": "Brady Holt",

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc