cronli5 0.3.1 → 0.7.2

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/lang/en.cjs CHANGED
@@ -59,13 +59,20 @@ function singleValues(segments) {
59
59
  function offsetCleanStride(stride) {
60
60
  return stride.start < stride.interval && 24 % stride.interval === 0;
61
61
  }
62
+ function lastTileOf(start, interval, cycle) {
63
+ return cycle - 1 - (cycle - 1 - start) % interval;
64
+ }
62
65
  function renderStride(spec, parts) {
63
- const { start, interval, cycle } = spec;
64
- const tiles = cycle % interval === 0;
65
- if (start === 0 && tiles) {
66
+ const { start, interval, last, cycle } = spec;
67
+ const open = cycle % interval === 0 && last === lastTileOf(
68
+ start,
69
+ interval,
70
+ cycle
71
+ );
72
+ if (start === 0 && open) {
66
73
  return parts.bare();
67
74
  }
68
- if (start < interval && tiles) {
75
+ if (start < interval && open) {
69
76
  return parts.offset();
70
77
  }
71
78
  return parts.bounded();
@@ -834,7 +841,7 @@ var renderers = {
834
841
  function renderStride2(stride, opts) {
835
842
  const { interval, start, last, cycle, unit, anchor } = stride;
836
843
  const cadence = "every " + getNumber(interval, opts) + " " + unit + "s";
837
- return renderStride({ start, interval, cycle }, {
844
+ return renderStride({ start, interval, last, cycle }, {
838
845
  bare: () => cadence,
839
846
  // A clean wrap from a non-zero offset: name the start, no endpoint.
840
847
  offset: () => cadence + " from " + getNumber(start, opts) + " " + pluralize(start, unit) + " past the " + anchor,
@@ -885,7 +892,7 @@ function stepHours(segment, opts) {
885
892
  function hourStrideCadence(stride, opts) {
886
893
  const { start, interval, last } = stride;
887
894
  const cadence = "every " + getNumber(interval, opts) + " hours";
888
- return renderStride({ start, interval, cycle: 24 }, {
895
+ return renderStride({ start, interval, last, cycle: 24 }, {
889
896
  bare: () => cadence,
890
897
  offset: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts),
891
898
  bounded: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts) + through(opts) + getTime({ hour: last, minute: 0 }, opts)
package/dist/lang/en.js CHANGED
@@ -33,13 +33,20 @@ function singleValues(segments) {
33
33
  function offsetCleanStride(stride) {
34
34
  return stride.start < stride.interval && 24 % stride.interval === 0;
35
35
  }
36
+ function lastTileOf(start, interval, cycle) {
37
+ return cycle - 1 - (cycle - 1 - start) % interval;
38
+ }
36
39
  function renderStride(spec, parts) {
37
- const { start, interval, cycle } = spec;
38
- const tiles = cycle % interval === 0;
39
- if (start === 0 && tiles) {
40
+ const { start, interval, last, cycle } = spec;
41
+ const open = cycle % interval === 0 && last === lastTileOf(
42
+ start,
43
+ interval,
44
+ cycle
45
+ );
46
+ if (start === 0 && open) {
40
47
  return parts.bare();
41
48
  }
42
- if (start < interval && tiles) {
49
+ if (start < interval && open) {
43
50
  return parts.offset();
44
51
  }
45
52
  return parts.bounded();
@@ -808,7 +815,7 @@ var renderers = {
808
815
  function renderStride2(stride, opts) {
809
816
  const { interval, start, last, cycle, unit, anchor } = stride;
810
817
  const cadence = "every " + getNumber(interval, opts) + " " + unit + "s";
811
- return renderStride({ start, interval, cycle }, {
818
+ return renderStride({ start, interval, last, cycle }, {
812
819
  bare: () => cadence,
813
820
  // A clean wrap from a non-zero offset: name the start, no endpoint.
814
821
  offset: () => cadence + " from " + getNumber(start, opts) + " " + pluralize(start, unit) + " past the " + anchor,
@@ -859,7 +866,7 @@ function stepHours(segment, opts) {
859
866
  function hourStrideCadence(stride, opts) {
860
867
  const { start, interval, last } = stride;
861
868
  const cadence = "every " + getNumber(interval, opts) + " hours";
862
- return renderStride({ start, interval, cycle: 24 }, {
869
+ return renderStride({ start, interval, last, cycle: 24 }, {
863
870
  bare: () => cadence,
864
871
  offset: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts),
865
872
  bounded: () => cadence + " from " + getTime({ hour: start, minute: 0 }, opts) + through(opts) + getTime({ hour: last, minute: 0 }, opts)
package/dist/lang/es.cjs CHANGED
@@ -101,13 +101,20 @@ function singleValues(segments) {
101
101
  function offsetCleanStride(stride) {
102
102
  return stride.start < stride.interval && 24 % stride.interval === 0;
103
103
  }
104
+ function lastTileOf(start, interval, cycle) {
105
+ return cycle - 1 - (cycle - 1 - start) % interval;
106
+ }
104
107
  function renderStride(spec, parts) {
105
- const { start, interval, cycle } = spec;
106
- const tiles = cycle % interval === 0;
107
- if (start === 0 && tiles) {
108
+ const { start, interval, last, cycle } = spec;
109
+ const open = cycle % interval === 0 && last === lastTileOf(
110
+ start,
111
+ interval,
112
+ cycle
113
+ );
114
+ if (start === 0 && open) {
108
115
  return parts.bare();
109
116
  }
110
- if (start < interval && tiles) {
117
+ if (start < interval && open) {
111
118
  return parts.offset();
112
119
  }
113
120
  return parts.bounded();
@@ -815,7 +822,7 @@ function renderStride2(stride, opts) {
815
822
  const { interval, start, last, cycle, unit, anchor } = stride;
816
823
  const cadence = "cada " + numero(interval, opts) + " " + unit + "s";
817
824
  const tail = anchor ? " de cada " + anchor : "";
818
- return renderStride({ start, interval, cycle }, {
825
+ return renderStride({ start, interval, last, cycle }, {
819
826
  bare: () => cadence,
820
827
  offset: () => cadence + " a partir del " + unit + " " + start + tail,
821
828
  bounded: () => cadence + " del " + unit + " " + start + " al " + last + tail
@@ -860,7 +867,7 @@ function stepHours(segment, opts) {
860
867
  function hourStrideCadence(stride, opts) {
861
868
  const { start, interval, last } = stride;
862
869
  const cadence = "cada " + numero(interval, opts) + " horas";
863
- return renderStride({ start, interval, cycle: 24 }, {
870
+ return renderStride({ start, interval, last, cycle: 24 }, {
864
871
  bare: () => cadence,
865
872
  offset: () => cadence + " a partir de " + timePhrase(start, 0, null, opts),
866
873
  bounded: () => cadence + " de " + timePhrase(start, 0, null, opts) + " a " + timePhrase(last, 0, null, opts)
package/dist/lang/es.js CHANGED
@@ -75,13 +75,20 @@ function singleValues(segments) {
75
75
  function offsetCleanStride(stride) {
76
76
  return stride.start < stride.interval && 24 % stride.interval === 0;
77
77
  }
78
+ function lastTileOf(start, interval, cycle) {
79
+ return cycle - 1 - (cycle - 1 - start) % interval;
80
+ }
78
81
  function renderStride(spec, parts) {
79
- const { start, interval, cycle } = spec;
80
- const tiles = cycle % interval === 0;
81
- if (start === 0 && tiles) {
82
+ const { start, interval, last, cycle } = spec;
83
+ const open = cycle % interval === 0 && last === lastTileOf(
84
+ start,
85
+ interval,
86
+ cycle
87
+ );
88
+ if (start === 0 && open) {
82
89
  return parts.bare();
83
90
  }
84
- if (start < interval && tiles) {
91
+ if (start < interval && open) {
85
92
  return parts.offset();
86
93
  }
87
94
  return parts.bounded();
@@ -789,7 +796,7 @@ function renderStride2(stride, opts) {
789
796
  const { interval, start, last, cycle, unit, anchor } = stride;
790
797
  const cadence = "cada " + numero(interval, opts) + " " + unit + "s";
791
798
  const tail = anchor ? " de cada " + anchor : "";
792
- return renderStride({ start, interval, cycle }, {
799
+ return renderStride({ start, interval, last, cycle }, {
793
800
  bare: () => cadence,
794
801
  offset: () => cadence + " a partir del " + unit + " " + start + tail,
795
802
  bounded: () => cadence + " del " + unit + " " + start + " al " + last + tail
@@ -834,7 +841,7 @@ function stepHours(segment, opts) {
834
841
  function hourStrideCadence(stride, opts) {
835
842
  const { start, interval, last } = stride;
836
843
  const cadence = "cada " + numero(interval, opts) + " horas";
837
- return renderStride({ start, interval, cycle: 24 }, {
844
+ return renderStride({ start, interval, last, cycle: 24 }, {
838
845
  bare: () => cadence,
839
846
  offset: () => cadence + " a partir de " + timePhrase(start, 0, null, opts),
840
847
  bounded: () => cadence + " de " + timePhrase(start, 0, null, opts) + " a " + timePhrase(last, 0, null, opts)
package/dist/lang/fi.cjs CHANGED
@@ -101,13 +101,20 @@ function singleValues(segments) {
101
101
  function offsetCleanStride(stride) {
102
102
  return stride.start < stride.interval && 24 % stride.interval === 0;
103
103
  }
104
+ function lastTileOf(start, interval, cycle) {
105
+ return cycle - 1 - (cycle - 1 - start) % interval;
106
+ }
104
107
  function renderStride(spec, parts) {
105
- const { start, interval, cycle } = spec;
106
- const tiles = cycle % interval === 0;
107
- if (start === 0 && tiles) {
108
+ const { start, interval, last, cycle } = spec;
109
+ const open = cycle % interval === 0 && last === lastTileOf(
110
+ start,
111
+ interval,
112
+ cycle
113
+ );
114
+ if (start === 0 && open) {
108
115
  return parts.bare();
109
116
  }
110
- if (start < interval && tiles) {
117
+ if (start < interval && open) {
111
118
  return parts.offset();
112
119
  }
113
120
  return parts.bounded();
@@ -750,7 +757,7 @@ var renderers = {
750
757
  function renderStride2(stride, opts) {
751
758
  const { interval, start, last, cycle, unit } = stride;
752
759
  const cadence = genitive(interval, opts) + " " + unit.gen + " v\xE4lein";
753
- return renderStride({ start, interval, cycle }, {
760
+ return renderStride({ start, interval, last, cycle }, {
754
761
  bare: () => cadence,
755
762
  offset: () => cadence + " " + unit.anchor + " " + unit.ela + " " + start + " alkaen",
756
763
  bounded: () => cadence + " " + unit.ela + " " + start + " " + unit.ill + " " + last
@@ -795,7 +802,7 @@ function stepHours(segment, opts) {
795
802
  function hourStrideCadence(stride, opts) {
796
803
  const { start, interval, last } = stride;
797
804
  const cadence = genitive(interval, opts) + " tunnin v\xE4lein";
798
- return renderStride({ start, interval, cycle: 24 }, {
805
+ return renderStride({ start, interval, last, cycle: 24 }, {
799
806
  bare: () => cadence,
800
807
  offset: () => cadence + " klo " + hourElatives[start] + " alkaen",
801
808
  bounded: () => cadence + " " + kloRange({ hour: start, minute: 0 }, { hour: last, minute: 0 }, opts)
package/dist/lang/fi.js CHANGED
@@ -75,13 +75,20 @@ function singleValues(segments) {
75
75
  function offsetCleanStride(stride) {
76
76
  return stride.start < stride.interval && 24 % stride.interval === 0;
77
77
  }
78
+ function lastTileOf(start, interval, cycle) {
79
+ return cycle - 1 - (cycle - 1 - start) % interval;
80
+ }
78
81
  function renderStride(spec, parts) {
79
- const { start, interval, cycle } = spec;
80
- const tiles = cycle % interval === 0;
81
- if (start === 0 && tiles) {
82
+ const { start, interval, last, cycle } = spec;
83
+ const open = cycle % interval === 0 && last === lastTileOf(
84
+ start,
85
+ interval,
86
+ cycle
87
+ );
88
+ if (start === 0 && open) {
82
89
  return parts.bare();
83
90
  }
84
- if (start < interval && tiles) {
91
+ if (start < interval && open) {
85
92
  return parts.offset();
86
93
  }
87
94
  return parts.bounded();
@@ -724,7 +731,7 @@ var renderers = {
724
731
  function renderStride2(stride, opts) {
725
732
  const { interval, start, last, cycle, unit } = stride;
726
733
  const cadence = genitive(interval, opts) + " " + unit.gen + " v\xE4lein";
727
- return renderStride({ start, interval, cycle }, {
734
+ return renderStride({ start, interval, last, cycle }, {
728
735
  bare: () => cadence,
729
736
  offset: () => cadence + " " + unit.anchor + " " + unit.ela + " " + start + " alkaen",
730
737
  bounded: () => cadence + " " + unit.ela + " " + start + " " + unit.ill + " " + last
@@ -769,7 +776,7 @@ function stepHours(segment, opts) {
769
776
  function hourStrideCadence(stride, opts) {
770
777
  const { start, interval, last } = stride;
771
778
  const cadence = genitive(interval, opts) + " tunnin v\xE4lein";
772
- return renderStride({ start, interval, cycle: 24 }, {
779
+ return renderStride({ start, interval, last, cycle: 24 }, {
773
780
  bare: () => cadence,
774
781
  offset: () => cadence + " klo " + hourElatives[start] + " alkaen",
775
782
  bounded: () => cadence + " " + kloRange({ hour: start, minute: 0 }, { hour: last, minute: 0 }, opts)