cronstrue 3.42.0 → 3.44.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.
@@ -106,6 +106,9 @@ var CronParser = (function () {
106
106
  };
107
107
  CronParser.prototype.normalize = function (expressionParts) {
108
108
  var _this = this;
109
+ for (var i = 0; i < expressionParts.length; i++) {
110
+ expressionParts[i] = expressionParts[i].toUpperCase();
111
+ }
109
112
  expressionParts[3] = expressionParts[3].replace("?", "*");
110
113
  expressionParts[5] = expressionParts[5].replace("?", "*");
111
114
  expressionParts[2] = expressionParts[2].replace("?", "*");
@@ -127,6 +130,12 @@ var CronParser = (function () {
127
130
  if (expressionParts[6].indexOf("1/") == 0) {
128
131
  expressionParts[6] = expressionParts[6].replace("1/", "*/");
129
132
  }
133
+ if (this.dayOfWeekStartIndexZero) {
134
+ expressionParts[5] = expressionParts[5]
135
+ .split(",")
136
+ .map(function (item) { return item.replace(/^0-7(?=\/|$)/, "0-6"); })
137
+ .join(",");
138
+ }
130
139
  expressionParts[5] = expressionParts[5].replace(/(^\d+)|([^#/\s\d]\d+)/g, function (t) {
131
140
  var dowDigits = t.replace(/\D/, "");
132
141
  var dowDigitsAdjusted = dowDigits;
@@ -140,9 +149,10 @@ var CronParser = (function () {
140
149
  }
141
150
  return t.replace(dowDigits, dowDigitsAdjusted);
142
151
  });
143
- if (expressionParts[5] == "L") {
144
- expressionParts[5] = "6";
145
- }
152
+ expressionParts[5] = expressionParts[5]
153
+ .split(",")
154
+ .map(function (item) { return (item == "L" ? "6" : item); })
155
+ .join(",");
146
156
  if (expressionParts[3] == "?") {
147
157
  expressionParts[3] = "*";
148
158
  }
@@ -164,6 +174,10 @@ var CronParser = (function () {
164
174
  for (var day in days) {
165
175
  expressionParts[5] = expressionParts[5].replace(new RegExp(day, "gi"), days[day].toString());
166
176
  }
177
+ expressionParts[5] = expressionParts[5]
178
+ .split(",")
179
+ .filter(function (item, index, items) { return item === "" || items.indexOf(item) === index; })
180
+ .join(",");
167
181
  expressionParts[4] = expressionParts[4].replace(/(^\d{1,2})|([^#/\s\d]\d{1,2})/g, function (t) {
168
182
  var dowDigits = t.replace(/\D/, "");
169
183
  var dowDigitsAdjusted = dowDigits;