cronstrue 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cronstrue-i18n.js +27 -18
- package/dist/cronstrue-i18n.min.js +1 -1
- package/dist/cronstrue.js +27 -18
- package/dist/cronstrue.min.js +1 -1
- package/dist/i18n/locales/en.d.ts +9 -9
- package/dist/rangeValidator.d.ts +1 -0
- package/locales/en.js +19 -18
- package/locales/en.min.js +1 -1
- package/package.json +1 -1
package/dist/cronstrue-i18n.js
CHANGED
|
@@ -242,6 +242,7 @@ var CronParser = (function () {
|
|
|
242
242
|
this.validateAnyRanges(parsed);
|
|
243
243
|
};
|
|
244
244
|
CronParser.prototype.validateAnyRanges = function (parsed) {
|
|
245
|
+
parsed.forEach(function (part) { return rangeValidator_1.default.stepRange(part); });
|
|
245
246
|
rangeValidator_1.default.secondRange(parsed[0]);
|
|
246
247
|
rangeValidator_1.default.minuteRange(parsed[1]);
|
|
247
248
|
rangeValidator_1.default.hourRange(parsed[2]);
|
|
@@ -2767,6 +2768,7 @@ exports.de = de;
|
|
|
2767
2768
|
|
|
2768
2769
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2769
2770
|
exports.en = void 0;
|
|
2771
|
+
var isOne = function (s) { return Number(s) === 1; };
|
|
2770
2772
|
var en = (function () {
|
|
2771
2773
|
function en() {
|
|
2772
2774
|
}
|
|
@@ -2809,26 +2811,26 @@ var en = (function () {
|
|
|
2809
2811
|
en.prototype.everySecond = function () {
|
|
2810
2812
|
return "every second";
|
|
2811
2813
|
};
|
|
2812
|
-
en.prototype.everyX0Seconds = function () {
|
|
2813
|
-
return "every %s seconds";
|
|
2814
|
+
en.prototype.everyX0Seconds = function (s) {
|
|
2815
|
+
return isOne(s) ? "every %s second" : "every %s seconds";
|
|
2814
2816
|
};
|
|
2815
2817
|
en.prototype.secondsX0ThroughX1PastTheMinute = function () {
|
|
2816
2818
|
return "seconds %s through %s past the minute";
|
|
2817
2819
|
};
|
|
2818
|
-
en.prototype.atX0SecondsPastTheMinute = function () {
|
|
2819
|
-
return "at %s seconds past the minute";
|
|
2820
|
+
en.prototype.atX0SecondsPastTheMinute = function (s) {
|
|
2821
|
+
return isOne(s) ? "at %s second past the minute" : "at %s seconds past the minute";
|
|
2820
2822
|
};
|
|
2821
|
-
en.prototype.everyX0Minutes = function () {
|
|
2822
|
-
return "every %s minutes";
|
|
2823
|
+
en.prototype.everyX0Minutes = function (s) {
|
|
2824
|
+
return isOne(s) ? "every %s minute" : "every %s minutes";
|
|
2823
2825
|
};
|
|
2824
2826
|
en.prototype.minutesX0ThroughX1PastTheHour = function () {
|
|
2825
2827
|
return "minutes %s through %s past the hour";
|
|
2826
2828
|
};
|
|
2827
|
-
en.prototype.atX0MinutesPastTheHour = function () {
|
|
2828
|
-
return "at %s minutes past the hour";
|
|
2829
|
+
en.prototype.atX0MinutesPastTheHour = function (s) {
|
|
2830
|
+
return isOne(s) ? "at %s minute past the hour" : "at %s minutes past the hour";
|
|
2829
2831
|
};
|
|
2830
|
-
en.prototype.everyX0Hours = function () {
|
|
2831
|
-
return "every %s hours";
|
|
2832
|
+
en.prototype.everyX0Hours = function (s) {
|
|
2833
|
+
return isOne(s) ? "every %s hour" : "every %s hours";
|
|
2832
2834
|
};
|
|
2833
2835
|
en.prototype.betweenX0AndX1 = function () {
|
|
2834
2836
|
return "between %s and %s";
|
|
@@ -2893,8 +2895,8 @@ var en = (function () {
|
|
|
2893
2895
|
en.prototype.commaOnTheLastWeekdayOfTheMonth = function () {
|
|
2894
2896
|
return ", on the last weekday of the month";
|
|
2895
2897
|
};
|
|
2896
|
-
en.prototype.commaDaysBeforeTheLastDayOfTheMonth = function () {
|
|
2897
|
-
return ", %s days before the last day of the month";
|
|
2898
|
+
en.prototype.commaDaysBeforeTheLastDayOfTheMonth = function (s) {
|
|
2899
|
+
return isOne(s) ? ", %s day before the last day of the month" : ", %s days before the last day of the month";
|
|
2898
2900
|
};
|
|
2899
2901
|
en.prototype.firstWeekday = function () {
|
|
2900
2902
|
return "first weekday";
|
|
@@ -2905,11 +2907,11 @@ var en = (function () {
|
|
|
2905
2907
|
en.prototype.commaOnTheX0OfTheMonth = function () {
|
|
2906
2908
|
return ", on the %s of the month";
|
|
2907
2909
|
};
|
|
2908
|
-
en.prototype.commaDaysBeforeTheX0OfTheMonth = function () {
|
|
2909
|
-
return ", %s days before the %s of the month";
|
|
2910
|
+
en.prototype.commaDaysBeforeTheX0OfTheMonth = function (s) {
|
|
2911
|
+
return isOne(s) ? ", %s day before the %s of the month" : ", %s days before the %s of the month";
|
|
2910
2912
|
};
|
|
2911
|
-
en.prototype.commaDaysAfterTheX0OfTheMonth = function () {
|
|
2912
|
-
return ", %s days after the %s of the month";
|
|
2913
|
+
en.prototype.commaDaysAfterTheX0OfTheMonth = function (s) {
|
|
2914
|
+
return isOne(s) ? ", %s day after the %s of the month" : ", %s days after the %s of the month";
|
|
2913
2915
|
};
|
|
2914
2916
|
en.prototype.commaEveryX0Days = function () {
|
|
2915
2917
|
return ", every %s days in a month";
|
|
@@ -2923,8 +2925,8 @@ var en = (function () {
|
|
|
2923
2925
|
en.prototype.commaEveryHour = function () {
|
|
2924
2926
|
return ", every hour";
|
|
2925
2927
|
};
|
|
2926
|
-
en.prototype.commaEveryX0Years = function () {
|
|
2927
|
-
return ", every %s years";
|
|
2928
|
+
en.prototype.commaEveryX0Years = function (s) {
|
|
2929
|
+
return isOne(s) ? ", every %s year" : ", every %s years";
|
|
2928
2930
|
};
|
|
2929
2931
|
en.prototype.commaStartingX0 = function () {
|
|
2930
2932
|
return ", starting %s";
|
|
@@ -9206,6 +9208,13 @@ function assert(value, message) {
|
|
|
9206
9208
|
var RangeValidator = (function () {
|
|
9207
9209
|
function RangeValidator() {
|
|
9208
9210
|
}
|
|
9211
|
+
RangeValidator.stepRange = function (parse) {
|
|
9212
|
+
var parsed = parse.split(',');
|
|
9213
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
9214
|
+
var step = parsed[i].split('/')[1];
|
|
9215
|
+
assert(step === undefined || !/^0+$/.test(step), 'step value must be greater than 0');
|
|
9216
|
+
}
|
|
9217
|
+
};
|
|
9209
9218
|
RangeValidator.secondRange = function (parse) {
|
|
9210
9219
|
var parsed = parse.split(',');
|
|
9211
9220
|
for (var i = 0; i < parsed.length; i++) {
|