cronstrue 3.25.0 → 3.26.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.
@@ -409,7 +409,7 @@ var ExpressionDescriptor = (function () {
409
409
  : parseInt(s) < 20
410
410
  ? _this.i18n.atX0SecondsPastTheMinute(s)
411
411
  : _this.i18n.atX0SecondsPastTheMinuteGt20() || _this.i18n.atX0SecondsPastTheMinute(s);
412
- });
412
+ }, { min: 0, max: 59 });
413
413
  return description;
414
414
  };
415
415
  ExpressionDescriptor.prototype.getMinutesDescription = function () {
@@ -436,7 +436,7 @@ var ExpressionDescriptor = (function () {
436
436
  catch (e) {
437
437
  return _this.i18n.atX0MinutesPastTheHour(s);
438
438
  }
439
- });
439
+ }, { min: 0, max: 59 });
440
440
  return description;
441
441
  };
442
442
  ExpressionDescriptor.prototype.getHoursDescription = function () {
@@ -466,7 +466,7 @@ var ExpressionDescriptor = (function () {
466
466
  return _this.i18n.betweenX0AndX1();
467
467
  }, function (s) {
468
468
  return _this.i18n.atX0();
469
- });
469
+ }, { min: 0, max: 23 });
470
470
  return description;
471
471
  };
472
472
  ExpressionDescriptor.prototype.getDayOfWeekDescription = function () {
@@ -637,7 +637,7 @@ var ExpressionDescriptor = (function () {
637
637
  });
638
638
  return description;
639
639
  };
640
- ExpressionDescriptor.prototype.getSegmentDescription = function (expression, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat) {
640
+ ExpressionDescriptor.prototype.getSegmentDescription = function (expression, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat, range) {
641
641
  var description = null;
642
642
  var doesExpressionContainIncrement = expression.indexOf("/") > -1;
643
643
  var doesExpressionContainRange = expression.indexOf("-") > -1;
@@ -706,12 +706,36 @@ var ExpressionDescriptor = (function () {
706
706
  rangeItemDescription = rangeItemDescription.replace(", ", "");
707
707
  description += stringUtilities_1.StringUtilities.format(this.i18n.commaStartingX0(), rangeItemDescription);
708
708
  }
709
+ description += this.getWrappingIncrementDescription(expression, range, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat);
709
710
  }
710
711
  else if (doesExpressionContainRange) {
711
712
  description = this.generateRangeSegmentDescription(expression, getRangeDescriptionFormat, getSingleItemDescription);
712
713
  }
713
714
  return description;
714
715
  };
716
+ ExpressionDescriptor.prototype.getWrappingIncrementDescription = function (expression, range, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat) {
717
+ if (!this.options.verbose || !range) {
718
+ return "";
719
+ }
720
+ var _a = expression.split("/"), start = _a[0], stepValue = _a[1];
721
+ var step = parseInt(stepValue);
722
+ var length = range.max - range.min + 1;
723
+ var coversWholeField = start === "*";
724
+ var isUsableStep = Number.isInteger(step) && step > 1;
725
+ var dividesEvenly = isUsableStep && length % step === 0;
726
+ if (!coversWholeField || !isUsableStep || dividesEvenly) {
727
+ return "";
728
+ }
729
+ var values = [];
730
+ for (var value = range.min; value <= range.max; value += step) {
731
+ values.push(value);
732
+ }
733
+ if (values.length < 2) {
734
+ return "";
735
+ }
736
+ var valuesDescription = this.getSegmentDescription(values.join(","), allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat);
737
+ return valuesDescription ? ", ".concat(valuesDescription) : "";
738
+ };
715
739
  ExpressionDescriptor.prototype.generateRangeSegmentDescription = function (rangeExpression, getRangeDescriptionFormat, getSingleItemDescription) {
716
740
  var description = "";
717
741
  var rangeSegments = rangeExpression.split("-");