cronstrue 3.47.0 → 3.48.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.
@@ -60,6 +60,21 @@ var CronParser = (function () {
60
60
  }
61
61
  this.normalize(parsed);
62
62
  this.validate(parsed);
63
+ var hasWildcardItem = function (part) { return part.indexOf(",") > -1 && part.split(",").indexOf("*") > -1; };
64
+ for (var _i = 0, _b = [
65
+ [3, 5],
66
+ [5, 3],
67
+ ]; _i < _b.length; _i++) {
68
+ var _c = _b[_i], part = _c[0], otherPart = _c[1];
69
+ if (hasWildcardItem(parsed[part]) && parsed[part][0] !== "*" && parsed[otherPart][0] !== "*") {
70
+ parsed[otherPart] = "*";
71
+ }
72
+ }
73
+ for (var i = 0; i < parsed.length; i++) {
74
+ if (hasWildcardItem(parsed[i])) {
75
+ parsed[i] = "*";
76
+ }
77
+ }
63
78
  return parsed;
64
79
  };
65
80
  CronParser.prototype.parseSpecial = function (expression) {
@@ -94,7 +109,9 @@ var CronParser = (function () {
94
109
  if (arrayElement.length === 0) {
95
110
  arrayElement.push("*");
96
111
  }
97
- arrayElement.sort(function (a, b) { return (a !== null && b !== null ? a - b : 0); });
112
+ if (arrayElement.indexOf("*") === -1) {
113
+ arrayElement.sort(function (a, b) { return (a !== null && b !== null ? a - b : 0); });
114
+ }
98
115
  parsed[i] = arrayElement.map(function (item) { return (item !== null ? item.toString() : ""); }).join(",");
99
116
  }
100
117
  }