atomic-fns 0.3.4 → 0.4.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.
Files changed (106) hide show
  1. package/README.md +3 -3
  2. package/{core → dist}/collections/BTree.d.ts +6 -6
  3. package/{core → dist}/collections/BTree.js +17 -17
  4. package/{core → dist}/collections/Heap.d.ts +3 -3
  5. package/{core → dist}/collections/Heap.js +0 -0
  6. package/dist/collections/LRUCache.d.ts +80 -0
  7. package/dist/collections/LRUCache.js +126 -0
  8. package/{core → dist}/collections/SortedMap.d.ts +2 -2
  9. package/{core → dist}/collections/SortedMap.js +0 -0
  10. package/{core → dist}/collections/SortedSet.d.ts +3 -3
  11. package/{core → dist}/collections/SortedSet.js +1 -1
  12. package/{core → dist}/collections/SortedTree.d.ts +3 -3
  13. package/{core → dist}/collections/SortedTree.js +1 -1
  14. package/{core → dist}/collections/SplayTree.d.ts +5 -5
  15. package/{core → dist}/collections/SplayTree.js +0 -0
  16. package/{core → dist}/collections/abc.d.ts +1 -1
  17. package/{core → dist}/collections/abc.js +0 -0
  18. package/dist/collections/deque.d.ts +117 -0
  19. package/{core → dist}/collections/deque.js +61 -53
  20. package/{core → dist}/collections/frozenset.d.ts +0 -0
  21. package/{core → dist}/collections/frozenset.js +3 -6
  22. package/{core → dist}/collections/index.d.ts +4 -4
  23. package/{core → dist}/collections/index.js +0 -0
  24. package/{core → dist}/functools/index.d.ts +28 -13
  25. package/{core → dist}/functools/index.js +34 -12
  26. package/{core → dist}/globals/index.d.ts +8 -11
  27. package/{core → dist}/globals/index.js +8 -15
  28. package/dist/i18n/date/index.d.ts +204 -0
  29. package/dist/i18n/date/index.js +530 -0
  30. package/dist/i18n/date/utils.d.ts +65 -0
  31. package/dist/i18n/date/utils.js +312 -0
  32. package/dist/i18n/duration.d.ts +112 -0
  33. package/dist/i18n/duration.js +392 -0
  34. package/dist/i18n/format.d.ts +26 -0
  35. package/dist/i18n/format.js +495 -0
  36. package/{core → dist}/i18n/index.d.ts +1 -1
  37. package/{core → dist}/i18n/index.js +1 -1
  38. package/{core → dist}/index.d.ts +0 -0
  39. package/{core → dist}/index.js +0 -0
  40. package/{core → dist}/itertools/index.d.ts +27 -27
  41. package/{core → dist}/itertools/index.js +24 -24
  42. package/{core → dist}/math/index.d.ts +3 -3
  43. package/{core → dist}/math/index.js +0 -0
  44. package/{core → dist}/operators/index.d.ts +2 -2
  45. package/{core → dist}/operators/index.js +2 -2
  46. package/{core → dist}/random/index.d.ts +1 -1
  47. package/{core → dist}/random/index.js +3 -3
  48. package/package.json +28 -42
  49. package/.editorconfig +0 -12
  50. package/.esdoc.json +0 -27
  51. package/.eslintignore +0 -1
  52. package/.eslintrc.json +0 -35
  53. package/.firebaserc +0 -5
  54. package/.prettierrc +0 -19
  55. package/core/collections/BTree.ts +0 -1340
  56. package/core/collections/Heap.ts +0 -189
  57. package/core/collections/LRUCache.d.ts +0 -152
  58. package/core/collections/LRUCache.js +0 -409
  59. package/core/collections/LRUCache.ts +0 -486
  60. package/core/collections/SortedMap.ts +0 -146
  61. package/core/collections/SortedSet.ts +0 -110
  62. package/core/collections/SortedTree.ts +0 -160
  63. package/core/collections/SplayTree.ts +0 -354
  64. package/core/collections/abc.ts +0 -176
  65. package/core/collections/deque.d.ts +0 -110
  66. package/core/collections/deque.ts +0 -329
  67. package/core/collections/frozenset.ts +0 -37
  68. package/core/collections/index.ts +0 -1024
  69. package/core/collections/test.html +0 -10
  70. package/core/collections/typedArrays.d.ts +0 -31
  71. package/core/collections/typedArrays.js +0 -143
  72. package/core/collections/typedArrays.ts +0 -163
  73. package/core/functools/index.ts +0 -258
  74. package/core/globals/index.ts +0 -481
  75. package/core/i18n/date/format.d.ts +0 -16
  76. package/core/i18n/date/format.js +0 -307
  77. package/core/i18n/date/format.ts +0 -343
  78. package/core/i18n/date/index.d.ts +0 -223
  79. package/core/i18n/date/index.js +0 -387
  80. package/core/i18n/date/index.ts +0 -471
  81. package/core/i18n/date/test.html +0 -67
  82. package/core/i18n/index.ts +0 -8
  83. package/core/index.ts +0 -8
  84. package/core/itertools/index.ts +0 -494
  85. package/core/math/index.ts +0 -152
  86. package/core/operators/index.ts +0 -310
  87. package/core/random/index.ts +0 -66
  88. package/firebase.json +0 -10
  89. package/jasmine.json +0 -14
  90. package/tests/BTree.spec.ts +0 -143
  91. package/tests/Cache.spec.ts +0 -161
  92. package/tests/Heap.spec.ts +0 -66
  93. package/tests/SortedMap.spec.ts +0 -144
  94. package/tests/SortedSet.spec.ts +0 -84
  95. package/tests/SortedTree.spec.ts +0 -164
  96. package/tests/SplayTree.spec.ts +0 -121
  97. package/tests/collections.spec.ts +0 -288
  98. package/tests/deque.spec.ts +0 -107
  99. package/tests/globals.spec.ts +0 -270
  100. package/tests/itertools.spec.ts +0 -266
  101. package/tests/math.spec.ts +0 -25
  102. package/tests/operators.spec.ts +0 -40
  103. package/tests/random.spec.ts +0 -46
  104. package/tsconfig.json +0 -126
  105. package/tsconfig.node.json +0 -18
  106. package/tsconfig.xo.json +0 -9
@@ -0,0 +1,495 @@
1
+ const NATIVE_DATE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
2
+ const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
3
+ const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|Q|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|N{1,4}|LTS?|L{1,4}|l{1,4}|x|X|SSS/g;
4
+ const FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
5
+ const padStart = (string, length, pad) => String(string).padStart(length, pad);
6
+ const padZoneStr = (instance) => {
7
+ const negMinutes = -instance.getTimezoneOffset();
8
+ const minutes = Math.abs(negMinutes);
9
+ const hourOffset = Math.floor(minutes / 60);
10
+ const minuteOffset = minutes % 60;
11
+ return `${negMinutes <= 0 ? '+' : '-'}${padStart(hourOffset, 2, '0')}:${padStart(minuteOffset, 2, '0')}`;
12
+ };
13
+ /**
14
+ * Returns a new Date from the given arguments.
15
+ * @param {string | number | Date} date The date value
16
+ * @param {?boolean} [utc=false] Interprets the given value as a UTC date
17
+ * @returns {Date} The new date object
18
+ */
19
+ export function asDate(date, utc = false) {
20
+ if (date === null) {
21
+ return new Date(NaN);
22
+ }
23
+ if (date === undefined) {
24
+ date = Date.now();
25
+ }
26
+ if (typeof date === 'string' && !/Z$/i.test(date)) {
27
+ const d = date.match(NATIVE_DATE);
28
+ if (d) {
29
+ const m = d[2] - 1 || 0;
30
+ const ms = (d[7] || '0').slice(0, 3);
31
+ if (utc) {
32
+ return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
33
+ }
34
+ return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
35
+ }
36
+ }
37
+ const fromDate = new Date(date);
38
+ if (utc) {
39
+ fromDate.setFullYear(fromDate.getUTCFullYear());
40
+ fromDate.setMonth(fromDate.getUTCMonth());
41
+ fromDate.setDate(fromDate.getUTCDate());
42
+ fromDate.setHours(fromDate.getUTCHours());
43
+ fromDate.setMinutes(fromDate.getUTCMinutes());
44
+ fromDate.setSeconds(fromDate.getUTCSeconds());
45
+ fromDate.setMilliseconds(fromDate.getUTCMilliseconds());
46
+ }
47
+ return fromDate;
48
+ }
49
+ const n = 'numeric';
50
+ const s = 'short';
51
+ const l = 'long';
52
+ const dd = '2-digit';
53
+ const STRFTIME = {
54
+ // weekday
55
+ '%A': { weekday: l },
56
+ '%a': { weekday: s },
57
+ '%aa': { weekday: n },
58
+ // day
59
+ '%d': { day: dd },
60
+ '%-d': { day: n },
61
+ // month
62
+ '%m': { month: dd },
63
+ '%-m': { month: n },
64
+ '%B': { month: l },
65
+ '%b': { month: s },
66
+ '%bb': { month: n },
67
+ // year
68
+ '%y': { year: n },
69
+ '%Y': { year: dd },
70
+ // hour
71
+ '%K': { hourCycle: 'h11', hour: dd },
72
+ '%I': { hourCycle: 'h12', hour: dd },
73
+ '%-I': { hourCycle: 'h12', hour: n },
74
+ '%H': { hourCycle: 'h23', hour: dd },
75
+ '%-H': { hourCycle: 'h23', hour: n },
76
+ '%k': { hourCycle: 'h24', hour: n },
77
+ // minutes
78
+ '%M': { minute: dd },
79
+ '%-M': { minute: n },
80
+ // seconds
81
+ '%S': { second: dd },
82
+ '%-S': { second: n },
83
+ // day period
84
+ '%P': { dayPeriod: l },
85
+ '%p': { dayPeriod: s },
86
+ '%pp': { dayPeriod: 'narrow' },
87
+ // era
88
+ '%N': { era: l, year: dd },
89
+ '%n': { era: s, year: dd },
90
+ '%nn': { era: n, year: 'narrow' },
91
+ // timeZoneName
92
+ // '%Z': { timeZoneName: 'longGeneric', year: dd },
93
+ // '%-Z': { timeZoneName: 'shortGeneric', year: dd },
94
+ '%z': { timeZoneName: 'longOffset', year: dd },
95
+ '%-z': { timeZoneName: 'shortOffset', year: dd },
96
+ '%Z': { timeZoneName: l, year: dd },
97
+ '%-Z': { timeZoneName: s, year: dd }
98
+ };
99
+ const TOKENS = {
100
+ // weekday
101
+ dddd: { weekday: l },
102
+ ddd: { weekday: s },
103
+ E: { weekday: n },
104
+ // day
105
+ DD: { day: dd },
106
+ D: { day: n },
107
+ // month
108
+ MM: { month: dd },
109
+ M: { month: n },
110
+ MMMM: { month: l },
111
+ MMM: { month: s },
112
+ // year
113
+ YYYY: { year: n },
114
+ YY: { year: dd },
115
+ // hour
116
+ hh: { hourCycle: 'h12', hour: dd },
117
+ h: { hourCycle: 'h12', hour: n },
118
+ HH: { hourCycle: 'h23', hour: dd },
119
+ H: { hourCycle: 'h23', hour: n },
120
+ kk: { hourCycle: 'h11', hour: dd },
121
+ k: { hourCycle: 'h24', hour: n },
122
+ // minutes
123
+ mm: { minute: dd },
124
+ m: { minute: n },
125
+ // seconds
126
+ ss: { second: dd },
127
+ s: { second: n },
128
+ // day period
129
+ A: { dayPeriod: l },
130
+ a: { dayPeriod: s },
131
+ // era
132
+ N: { era: s, year: dd },
133
+ NN: { era: s, year: dd },
134
+ NNN: { era: s, year: dd },
135
+ NNNN: { era: l, year: dd },
136
+ // timeZoneName
137
+ ZZ: { timeZoneName: 'longOffset', year: dd },
138
+ Z: { timeZoneName: 'shortOffset', year: dd },
139
+ zzz: { timeZoneName: l, year: dd },
140
+ z: { timeZoneName: s, year: dd }
141
+ };
142
+ const HOUR_PARTS = { '%I': 1, '%-I': 1, '%K': 1, '%k': 1 };
143
+ const ERA_PARTS = { '%n': 1, '%N': 1, '%nn': 1 };
144
+ const TZ_PARTS = { '%ZZ': 1, '%-ZZ': 1, '%-z': 1, '%z': 1, '%-Z': 1, '%Z': 1 };
145
+ const formatter = (locale, opts) => new Intl.DateTimeFormat(locale, opts);
146
+ const formatHour = (h, maxLength) => String(h % 12 || 12).padStart(maxLength, '0');
147
+ const formatMeridiem = (hour, isLowercase) => {
148
+ const m = hour < 12 ? 'AM' : 'PM';
149
+ return isLowercase ? m.toLowerCase() : m;
150
+ };
151
+ const formatPart = (locale, t, date) => {
152
+ const value = formatter(locale, TOKENS[t]).format(date);
153
+ return value.split(/\s+/g).slice(1).join(' ');
154
+ };
155
+ /**
156
+ * Returns a localized string representation of this date, according to the given format string. Format codes use the same specification as {@link https://momentjs.com/docs/#/displaying/format/ moment}.
157
+ * @param {string} str The format string to use
158
+ * @see {@link https://momentjs.com/docs/#/displaying/format/ List of formats}
159
+ * @example
160
+ ```js
161
+ formatDate(new Date(), 'MM/DD/YYYY') // '10/31/2022'
162
+ ```
163
+ */
164
+ export function formatDate(formatStr, date, locale) {
165
+ const str = formatStr || FORMAT_DEFAULT;
166
+ const zoneStr = padZoneStr(date);
167
+ const time = {
168
+ H: date.getHours(),
169
+ HH: padStart(date.getHours(), 2, '0'),
170
+ h: formatHour(date.getHours(), 1),
171
+ hh: formatHour(date.getHours(), 2),
172
+ a: formatMeridiem(date.getHours(), true),
173
+ A: formatMeridiem(date.getHours()),
174
+ m: date.getMinutes(),
175
+ mm: padStart(date.getMinutes(), 2, '0'),
176
+ s: date.getSeconds(),
177
+ ss: padStart(date.getSeconds(), 2, '0'),
178
+ SSS: padStart(date.getMilliseconds(), 3, '0'),
179
+ X: Math.floor(date.getTime() / 1000),
180
+ x: date.getTime()
181
+ };
182
+ const matches = {
183
+ ...time,
184
+ N: formatPart(locale, 'N', date),
185
+ NN: formatPart(locale, 'NN', date),
186
+ NNN: formatPart(locale, 'NNN', date),
187
+ NNNN: formatPart(locale, 'NNNN', date),
188
+ YY: String(date.getFullYear()).slice(-2),
189
+ YYYY: date.getFullYear(),
190
+ M: date.getMonth() + 1,
191
+ MM: padStart(date.getMonth() + 1, 2, '0'),
192
+ MMM: formatter(locale, TOKENS.MMM).format(date),
193
+ MMMM: formatter(locale, TOKENS.MMMM).format(date),
194
+ Q: Math.ceil((date.getMonth() + 1) / 3),
195
+ D: date.getDate(),
196
+ DD: padStart(date.getDate(), 2, '0'),
197
+ d: date.getDay(),
198
+ ddd: formatter(locale, TOKENS.ddd).format(date),
199
+ dddd: formatter(locale, TOKENS.dddd).format(date),
200
+ Z: formatPart(locale, 'Z', date),
201
+ ZZ: formatPart(locale, 'ZZ', date),
202
+ z: formatPart(locale, 'z', date),
203
+ zzz: formatPart(locale, 'zzz', date),
204
+ LT: `${time.h}:${time.mm} ${time.A}`,
205
+ LTS: `${time.h}:${time.mm}:${time.ss} ${time.A}`,
206
+ L: formatter(locale, DATE_SHORT_DD).format(date),
207
+ LL: formatter(locale, DATE_FULL).format(date),
208
+ LLL: formatter(locale, DATE_LONG_TIME).format(date),
209
+ LLLL: formatter(locale, DATE_HUGE).format(date),
210
+ l: formatter(locale, DATE_SHORT).format(date),
211
+ ll: formatter(locale, DATE_MED).format(date),
212
+ lll: formatter(locale, DATE_MED_TIME).format(date),
213
+ llll: formatter(locale, DATE_MED_WITH_WEEKDAY).format(date)
214
+ };
215
+ return str.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match] || zoneStr.replace(':', '')); // 'ZZ'
216
+ }
217
+ /**
218
+ * Formats a date using a formatting string in the {@link https://strftime.org/ strftime} format, in any given locale.
219
+ * @param {string} fmt The format string to apply
220
+ * @param {number | Date} date The date value
221
+ * @param {?string} locale The locale to use when formatting (default is system locale).
222
+ * @returns {string} The string representation of date
223
+ * @see {@link https://strftime.org/ strftime format}
224
+ */
225
+ export function strftime(fmt, date, locale) {
226
+ const results = [];
227
+ let dayPeriod = '';
228
+ let dayPeriodIndex = -1;
229
+ for (let i = 0; i < fmt.length; i++) {
230
+ let part = fmt[i];
231
+ if (part === '%') {
232
+ // check for escaped '%'
233
+ if (fmt[++i] === '%') {
234
+ results.push('%');
235
+ continue;
236
+ }
237
+ if (fmt[i] === '-') {
238
+ part += fmt[i++];
239
+ }
240
+ part += fmt[i];
241
+ // add any repeated characters that come after
242
+ while (i < fmt.length - 1 && fmt[i + 1] === fmt[i])
243
+ part += fmt[++i];
244
+ if (HOUR_PARTS[part]) {
245
+ const res = formatter(locale, STRFTIME[part]).format(date).split(/\s+/g);
246
+ // save the AM/PM for the correct spot
247
+ results.push(res[0]);
248
+ dayPeriod = res[1];
249
+ continue;
250
+ }
251
+ if (part === '%P' || part === '%p') {
252
+ // leave this flag in place for later
253
+ dayPeriodIndex = results.length;
254
+ if (part === '%p' && dayPeriod) {
255
+ dayPeriod = dayPeriod.toLowerCase();
256
+ }
257
+ results.push(part);
258
+ continue;
259
+ }
260
+ if (ERA_PARTS[part] || TZ_PARTS[part]) {
261
+ // the formatting includes the date/year so we take what comes after
262
+ const res = formatter(locale, STRFTIME[part]).format(date).split(/\s+/g);
263
+ results.push(res.slice(1).join(' '));
264
+ continue;
265
+ }
266
+ // format any other parts
267
+ let res = formatter(locale, STRFTIME[part]).format(date);
268
+ // fix bugs in time formatter
269
+ if ((part === '%S' || part === '%M') && res.length === 1)
270
+ res = '0' + res;
271
+ results.push(res);
272
+ }
273
+ else {
274
+ // output as literal
275
+ results.push(part);
276
+ }
277
+ }
278
+ // insert the AM/PM at the correct spot
279
+ if (dayPeriodIndex >= 0)
280
+ results[dayPeriodIndex] = dayPeriod || '';
281
+ return results.join('').trim();
282
+ }
283
+ const DATETIME_DEFAULT = {};
284
+ /** L: 09/04/1983 */
285
+ const DATE_SHORT_DD = {
286
+ year: n,
287
+ month: dd,
288
+ day: dd
289
+ };
290
+ /** l: 9/4/1983 */
291
+ const DATE_SHORT = {
292
+ year: n,
293
+ month: n,
294
+ day: n
295
+ };
296
+ /** ll: Oct 14, 1983 */
297
+ const DATE_MED = {
298
+ year: n,
299
+ month: s,
300
+ day: n
301
+ };
302
+ /** LL: October 14, 1983 */
303
+ const DATE_FULL = {
304
+ year: n,
305
+ month: l,
306
+ day: n
307
+ };
308
+ /** lll: Oct 14, 1983 8:30 PM */
309
+ const DATE_MED_TIME = {
310
+ year: n,
311
+ month: s,
312
+ day: n,
313
+ hour: n,
314
+ minute: n,
315
+ hourCycle: 'h12'
316
+ };
317
+ /** LLL: October 14, 1983 8:30 PM */
318
+ const DATE_LONG_TIME = {
319
+ year: n,
320
+ month: l,
321
+ day: n,
322
+ hour: n,
323
+ minute: n,
324
+ hourCycle: 'h12'
325
+ };
326
+ /** llll: Fri, Oct 14, 1983, 8:30 PM */
327
+ const DATE_MED_WITH_WEEKDAY = {
328
+ year: n,
329
+ month: s,
330
+ day: n,
331
+ weekday: s,
332
+ hour: n,
333
+ minute: n,
334
+ hourCycle: 'h12'
335
+ };
336
+ /** LLLL: Tuesday, October 14, 1983, 8:30 PM */
337
+ const DATE_HUGE = {
338
+ year: n,
339
+ month: l,
340
+ day: n,
341
+ weekday: l,
342
+ hour: n,
343
+ minute: n,
344
+ hourCycle: 'h12'
345
+ };
346
+ /** LT: 09:30 AM */
347
+ const TIME_SIMPLE = {
348
+ hour: n,
349
+ minute: n,
350
+ hourCycle: 'h12'
351
+ };
352
+ /** LTS: 09:30:23 AM */
353
+ const TIME_WITH_SECONDS = {
354
+ hour: n,
355
+ minute: n,
356
+ second: n,
357
+ hourCycle: 'h12'
358
+ };
359
+ /** 09:30:23 AM EDT */
360
+ const TIME_WITH_SHORT_OFFSET = {
361
+ hour: n,
362
+ minute: n,
363
+ second: n,
364
+ timeZoneName: s,
365
+ hourCycle: 'h12'
366
+ };
367
+ /** 09:30:23 AM Eastern Daylight Time */
368
+ const TIME_WITH_LONG_OFFSET = {
369
+ hour: n,
370
+ minute: n,
371
+ second: n,
372
+ timeZoneName: l,
373
+ hourCycle: 'h12'
374
+ };
375
+ /** 09:30 */
376
+ const TIME_24_SIMPLE = {
377
+ hour: n,
378
+ minute: n,
379
+ hourCycle: 'h23'
380
+ };
381
+ /** 09:30:23 */
382
+ const TIME_24_WITH_SECONDS = {
383
+ hour: n,
384
+ minute: n,
385
+ second: n,
386
+ hourCycle: 'h23'
387
+ };
388
+ /** 09:30:23 EDT */
389
+ const TIME_24_WITH_SHORT_OFFSET = {
390
+ hour: n,
391
+ minute: n,
392
+ second: n,
393
+ hourCycle: 'h23',
394
+ timeZoneName: s
395
+ };
396
+ /** 09:30:23 Eastern Daylight Time */
397
+ const TIME_24_WITH_LONG_OFFSET = {
398
+ hour: n,
399
+ minute: n,
400
+ second: n,
401
+ hourCycle: 'h23',
402
+ timeZoneName: l
403
+ };
404
+ /** 10/14/1983, 9:30 AM */
405
+ const DATETIME_SHORT = {
406
+ year: n,
407
+ month: n,
408
+ day: n,
409
+ hour: n,
410
+ minute: n,
411
+ hourCycle: 'h12'
412
+ };
413
+ /** 10/14/1983, 9:30:33 AM */
414
+ const DATETIME_SHORT_WITH_SECONDS = {
415
+ year: n,
416
+ month: n,
417
+ day: n,
418
+ hour: n,
419
+ minute: n,
420
+ second: n,
421
+ hourCycle: 'h12'
422
+ };
423
+ /** Oct 14, 1983, 9:30 AM */
424
+ const DATETIME_MED = {
425
+ year: n,
426
+ month: s,
427
+ day: n,
428
+ hour: n,
429
+ minute: n,
430
+ hourCycle: 'h12'
431
+ };
432
+ /** Oct 14, 1983, 9:30:33 AM */
433
+ const DATETIME_MED_WITH_SECONDS = {
434
+ year: n,
435
+ month: s,
436
+ day: n,
437
+ hour: n,
438
+ minute: n,
439
+ second: n,
440
+ hourCycle: 'h12'
441
+ };
442
+ /** Fri, 14 Oct 1983, 9:30 AM */
443
+ const DATETIME_MED_WITH_WEEKDAY = {
444
+ year: n,
445
+ month: s,
446
+ day: n,
447
+ weekday: s,
448
+ hour: n,
449
+ minute: n,
450
+ hourCycle: 'h12'
451
+ };
452
+ /** October 14, 1983, 9:30 AM EDT */
453
+ const DATETIME_FULL = {
454
+ year: n,
455
+ month: l,
456
+ day: n,
457
+ hour: n,
458
+ minute: n,
459
+ timeZoneName: s,
460
+ hourCycle: 'h12'
461
+ };
462
+ /** October 14, 1983, 9:30:33 AM EDT */
463
+ const DATETIME_FULL_WITH_SECONDS = {
464
+ year: n,
465
+ month: l,
466
+ day: n,
467
+ hour: n,
468
+ minute: n,
469
+ second: n,
470
+ timeZoneName: s,
471
+ hourCycle: 'h12'
472
+ };
473
+ /** Friday, October 14, 1983, 9:30 AM Eastern Daylight Time */
474
+ const DATETIME_HUGE = {
475
+ year: n,
476
+ month: l,
477
+ day: n,
478
+ weekday: l,
479
+ hour: n,
480
+ minute: n,
481
+ timeZoneName: l,
482
+ hourCycle: 'h12'
483
+ };
484
+ /** Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time */
485
+ const DATETIME_HUGE_WITH_SECONDS = {
486
+ year: n,
487
+ month: l,
488
+ day: n,
489
+ weekday: l,
490
+ hour: n,
491
+ minute: n,
492
+ second: n,
493
+ timeZoneName: l,
494
+ hourCycle: 'h12'
495
+ };
@@ -4,4 +4,4 @@
4
4
  * @module i18n
5
5
  */
6
6
  export * from './date/index.js';
7
- export * from './date/format.js';
7
+ export { Duration, TDuration, DurationUnit } from './duration.js';
@@ -4,4 +4,4 @@
4
4
  * @module i18n
5
5
  */
6
6
  export * from './date/index.js';
7
- export * from './date/format.js';
7
+ export { Duration } from './duration.js';
File without changes
File without changes
@@ -21,13 +21,13 @@ export declare function accumulate<T>(iterable: Iterable<T>, func?: typeof add,
21
21
  * @example
22
22
  ```js
23
23
  all([0])
24
- // => true
24
+ // true
25
25
 
26
26
  all([1, 2, 3])
27
- // => true
27
+ // true
28
28
 
29
29
  all([2, 4, 6] => (n) => n > 1)
30
- // => true
30
+ // true
31
31
  ```
32
32
  @see {@link any}
33
33
  */
@@ -40,13 +40,13 @@ export declare const all: <T>(iterable: Iterable<T>, fn?: Predicate<T>) => boole
40
40
  * @example
41
41
  ```js
42
42
  any([0])
43
- // => false
43
+ // false
44
44
 
45
45
  any([0, 1, null, undefined])
46
- // => true
46
+ // true
47
47
 
48
48
  any([1, 4, 5] => (n) => n % 2 === 0)
49
- // => true
49
+ // true
50
50
  ```
51
51
  @see {@link all}
52
52
  */
@@ -60,16 +60,16 @@ export declare function chain<T>(...iterables: Array<Iterable<T>>): Generator<T,
60
60
  * @example
61
61
  ```js
62
62
  contains([1, 2, 3], 1)
63
- // => true
63
+ // true
64
64
 
65
65
  contains([1, 2, 3], 1, 2)
66
- // => false
66
+ // false
67
67
 
68
68
  contains({ 'a': 1, 'b': 2 }, 1)
69
- // => true
69
+ // true
70
70
 
71
71
  contains('abcd', 'bc')
72
- // => true
72
+ // true
73
73
  ```
74
74
  *
75
75
  * @see {@link Collections.find}
@@ -81,7 +81,7 @@ export declare function contains(collection: Iterable<any>, value: any): any;
81
81
  * @param predicate A function invoked per element to check if it should be dropped.
82
82
  * @returns Elements
83
83
  */
84
- export declare function dropWhile<T>(iterable: Iterable<T>, predicate: Predicate): Generator<unknown, any, unknown>;
84
+ export declare function dropWhile<T>(iterable: Iterable<T>, predicate: Predicate): Generator<any, any, unknown>;
85
85
  export declare function iforEach<T>(iterable: Iterable<T>, fun: Iteratee<T>): void;
86
86
  export declare function IterableIterator<T = any>(next: any): Iterator<T, any, undefined> & Iterable<T>;
87
87
  /**
@@ -93,11 +93,11 @@ export declare function IterableIterator<T = any>(next: any): Iterator<T, any, u
93
93
  * @example
94
94
  ```js
95
95
  console.log([...enumerate(['hello', 'world'])])
96
- // => [[0, 'hello'], [1, 'world']]
96
+ // [[0, 'hello'], [1, 'world']]
97
97
 
98
98
  // Start with index `1`
99
99
  console.log([...enumerate(['hello', 'world'], 1)])
100
- // => [[1, 'hello'], [2, 'world']]
100
+ // [[1, 'hello'], [2, 'world']]
101
101
  ```
102
102
  */
103
103
  export declare function enumerate<T = any>(iterable: Iterable<T>, start?: number): Generator<(number | T)[], void, unknown>;
@@ -114,7 +114,7 @@ export declare function first<T>(iterable: Iterable<T>): any;
114
114
  * @example
115
115
  ```js
116
116
  compact([0, 1, false, 2, '', 3])
117
- // => [1, 2, 3]
117
+ // [1, 2, 3]
118
118
  ```
119
119
  */
120
120
  export declare function icompact<T>(iterable: Iterable<T>): Generator<T, void, unknown>;
@@ -129,13 +129,13 @@ export declare function imap<T, TReturn = any>(iterable: Iterable<T>, mapFn: (x:
129
129
  * @example
130
130
  ```js
131
131
  [...iflatten([[0, 1], [2, 3]])]
132
- // => [0, 1, 2, 3]
132
+ // [0, 1, 2, 3]
133
133
  ```
134
134
  */
135
135
  export declare function iflatten<T = any>(iterables: Iterable<Iterable<T>>): Generator<T, void, unknown>;
136
136
  export declare function flatMap<T>(iterable: Iterable<T>, mapFn?: (x: T) => any): Generator<T, void, unknown>;
137
- export declare function islice<T>(iterable: Iterable<T>, start: number, stop?: number, step?: number): Generator<number | T, number | T | undefined, unknown>;
138
- export declare function itake<T>(n: number, iterable: Iterable<T>): Generator<unknown, void, unknown>;
137
+ export declare function islice<T>(iterable: Iterable<T>, start: number, stop?: number, step?: number): Generator<number | T, number | T, unknown>;
138
+ export declare function itake<T>(n: number, iterable: Iterable<T>): Generator<any, void, unknown>;
139
139
  /**
140
140
  * Returns an Iterator from the elements of a collection or the object keys.
141
141
  * @param obj The given collection to iterate over.
@@ -151,19 +151,19 @@ export declare function partition<T>(iterable: Iterable<T>, predicate: Predicate
151
151
  * @example
152
152
  ```js
153
153
  range(5)
154
- // => [0, 1, 2, 3, 4]
154
+ // [0, 1, 2, 3, 4]
155
155
 
156
156
  range(2, 5)
157
- // => [2, 3, 4]
157
+ // [2, 3, 4]
158
158
 
159
159
  range(0, 5, 2)
160
- // => [0, 2, 4]
160
+ // [0, 2, 4]
161
161
 
162
162
  range(5, 0, -1)
163
- // => [5, 4, 3, 2, 1]
163
+ // [5, 4, 3, 2, 1]
164
164
 
165
165
  range(-3)
166
- // => []
166
+ // []
167
167
  ```
168
168
  */
169
169
  export declare function range(...args: number[]): Generator<number, void, unknown>;
@@ -176,7 +176,7 @@ export declare function range(...args: number[]): Generator<number, void, unknow
176
176
  * @example
177
177
  ```js
178
178
  reduce([1, 2, 3, 4, 5], (x, y) => x + y, 0)
179
- // => 15
179
+ // 15
180
180
  ```
181
181
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce Array.reduce()}
182
182
  */
@@ -196,7 +196,7 @@ export declare function sort(args: any[]): any[];
196
196
  export declare function sort(args: any[], reverse: boolean): any[];
197
197
  export declare function sort(args: any[], compareFn: Comparer): any[];
198
198
  export declare function sort(args: any[], reverse: boolean, compareFn: Comparer): any[];
199
- export declare function take<T>(n: number, iterable: Iterable<T>): unknown[];
199
+ export declare function take<T>(n: number, iterable: Iterable<T>): any[];
200
200
  /**
201
201
  * Returns a generator that takes elements from the iterable as long as the predicate is `true`.
202
202
  * @param iterable The iterable to inspect.
@@ -219,9 +219,9 @@ export declare function times(n: number, fn: (index: number) => any): Generator<
219
219
  ```js
220
220
  for item of zip([1, 2, 3], ['sugar', 'spice', 'nice'])
221
221
  console.log(item)
222
- // => [1, 'sugar']
223
- // => [2, 'spice']
224
- // => [3, 'nice']
222
+ // [1, 'sugar']
223
+ // [2, 'spice']
224
+ // [3, 'nice']
225
225
  ```
226
226
  */
227
227
  export declare function zip(...args: Array<Iterable<any>>): Generator<any[], void, unknown>;