@wistia/utils 0.17.0 → 1.0.1

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/index.cjs DELETED
@@ -1,1921 +0,0 @@
1
-
2
- /*
3
- * @license @wistia/utils v0.17.0
4
- *
5
- * Copyright (c) 2023-2026, Wistia, Inc. and its affiliates.
6
- *
7
- * This source code is unlicensed, all rights reserved.
8
- */
9
-
10
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
11
- //#region src/guards/isNull.ts
12
- /**
13
- * Checks if the provided value is null.
14
- *
15
- * @param value - The value to check.
16
- * @returns True if the value is null, false otherwise.
17
- *
18
- * @example
19
- * isNull(null); // true
20
- * isNull(undefined); // false
21
- *
22
- * @category Primitives
23
- */
24
- const isNull = (value) => value === null;
25
- //#endregion
26
- //#region src/guards/isUndefined.ts
27
- /**
28
- * Checks if the provided value is undefined.
29
- *
30
- * @param value - The value to check.
31
- * @returns True if the value is undefined, false otherwise.
32
- *
33
- * @example
34
- * isUndefined(undefined); // true
35
- * isUndefined(null); // false
36
- *
37
- * @category Primitives
38
- */
39
- const isUndefined = (value) => value === void 0;
40
- //#endregion
41
- //#region src/guards/isNil.ts
42
- /**
43
- * Checks if the provided value is null or undefined.
44
- *
45
- * @param value - The value to check.
46
- * @returns True if the value is null or undefined, false otherwise.
47
- *
48
- * @example
49
- * isNil(null); // true
50
- * isNil(0); // false
51
- *
52
- * @category Primitives
53
- */
54
- const isNil = (value) => isNull(value) || isUndefined(value);
55
- //#endregion
56
- //#region src/guards/isNotNil.ts
57
- /**
58
- * Checks if the provided value is neither null nor undefined.
59
- *
60
- * @param value - The value to check.
61
- * @returns True if the value is not null or undefined, false otherwise.
62
- *
63
- * @remarks
64
- * Common in `.filter(isNotNil)` to drop `null`/`undefined` from arrays
65
- * with narrowing.
66
- *
67
- * @example
68
- * isNotNil(0); // true
69
- * isNotNil(null); // false
70
- *
71
- * const items: (string | null)[] = ['a', null, 'b'];
72
- * const clean: string[] = items.filter(isNotNil); // ['a', 'b']
73
- *
74
- * @category Negated
75
- */
76
- const isNotNil = (value) => !isNil(value);
77
- //#endregion
78
- //#region src/guards/isRecord.ts
79
- /**
80
- * Checks if the provided value is a non-null object that is not an array.
81
- *
82
- * @param value - The value to check.
83
- * @returns True if the value is an object (but not an array), false otherwise.
84
- *
85
- * @example
86
- * isRecord({}); // true
87
- * isRecord([]); // false
88
- *
89
- * @category Records
90
- */
91
- const isRecord = (value) => isNotNil(value) && typeof value === "object" && !Array.isArray(value);
92
- //#endregion
93
- //#region src/guards/isNonEmptyRecord.ts
94
- /**
95
- * Checks if the provided value is an object with at least one own property.
96
- *
97
- * @param value - The value to check.
98
- * @returns True if the value is a non-empty object, false otherwise.
99
- *
100
- * @example
101
- * isNonEmptyRecord({ a: 1 }); // true
102
- * isNonEmptyRecord({}); // false
103
- *
104
- * @category Records
105
- */
106
- const isNonEmptyRecord = (value) => isRecord(value) && Object.keys(value).length > 0;
107
- //#endregion
108
- //#region src/guards/hasKey.ts
109
- /**
110
- * Curried function that tests if an input is an object
111
- * _and_ that a key that was passed in is a property of that object.
112
- *
113
- * @param value - The input object to test.
114
- * @param key - The key to test if it is a property of the input record.
115
- * @returns A function that takes an unknown input and then tests if the
116
- * input is an object and whether the key is a property of that object or not.
117
- *
118
- * @example
119
- * hasKey({ a: 1 }, 'a'); // true
120
- * hasKey({ a: 1 }, 'b'); // false
121
- *
122
- * @category Records
123
- */
124
- const hasKey = (value, key) => isNonEmptyRecord(value) && key in value;
125
- //#endregion
126
- //#region src/guards/isArray.ts
127
- /**
128
- * Checks if the provided value is an array.
129
- *
130
- * @param value - The value to check.
131
- * @returns True if the value is an array, false otherwise.
132
- *
133
- * @example
134
- * isArray([1, 2]); // true
135
- * isArray('abc'); // false
136
- *
137
- * @category Arrays
138
- */
139
- const isArray = (value) => isNotNil(value) && typeof value === "object" && Array.isArray(value);
140
- //#endregion
141
- //#region src/guards/isFunction.ts
142
- /**
143
- * Checks if the provided value is a function.
144
- *
145
- * @param value - The value to check.
146
- * @returns True if the value is a function, false otherwise.
147
- *
148
- * @example
149
- * isFunction(() => {}); // true
150
- * isFunction({}); // false
151
- *
152
- * @category Primitives
153
- */
154
- const isFunction = (value) => isNotNil(value) && typeof value === "function";
155
- //#endregion
156
- //#region src/guards/isAsyncFunction.ts
157
- /**
158
- * Checks if the provided value is an async function.
159
- *
160
- * @param value - The value to check.
161
- * @returns True if the value is an async function, false otherwise.
162
- *
163
- * @remarks
164
- * Detection relies on `constructor.name === 'AsyncFunction'` and is a
165
- * heuristic: async functions transpiled to regular functions return false,
166
- * async generator functions return false, and a forged `constructor`
167
- * property can fool the check. Bound async functions return true, since
168
- * `bind` preserves the prototype chain. Synchronous functions that return
169
- * promises also return false.
170
- *
171
- * @example
172
- * isAsyncFunction(async () => {}); // true
173
- * isAsyncFunction(() => {}); // false
174
- *
175
- * @category Primitives
176
- */
177
- const isAsyncFunction = (value) => {
178
- return isFunction(value) && value.constructor?.name === "AsyncFunction";
179
- };
180
- //#endregion
181
- //#region src/guards/isBigInt.ts
182
- /**
183
- * Checks if the provided value is a bigint.
184
- *
185
- * @param value - The value to check.
186
- * @returns True if the value is a bigint, false otherwise.
187
- *
188
- * @example
189
- * isBigInt(10n); // true
190
- * isBigInt(10); // false
191
- *
192
- * @category Primitives
193
- */
194
- const isBigInt = (value) => typeof value === "bigint";
195
- //#endregion
196
- //#region src/guards/isBoolean.ts
197
- /**
198
- * Checks if the provided value is a boolean.
199
- *
200
- * @param value - The value to check.
201
- * @returns True if the value is a boolean, false otherwise.
202
- *
203
- * @example
204
- * isBoolean(true); // true
205
- * isBoolean(1); // false
206
- *
207
- * @category Primitives
208
- */
209
- const isBoolean = (value) => isNotNil(value) && typeof value === "boolean";
210
- //#endregion
211
- //#region src/guards/isDate.ts
212
- /**
213
- * Checks if the provided value is an instance of Date.
214
- *
215
- * @param value - The value to check.
216
- * @returns True if the value is a Date instance, false otherwise.
217
- *
218
- * @remarks
219
- * Matches `Date` instances only. Does not parse date strings or
220
- * accept numeric timestamps.
221
- *
222
- * @example
223
- * isDate(new Date()); // true
224
- * isDate('2024-01-01'); // false
225
- *
226
- * @category Primitives
227
- */
228
- const isDate = (value) => {
229
- return isNotNil(value) && value instanceof Date;
230
- };
231
- //#endregion
232
- //#region src/guards/isEmptyArray.ts
233
- /**
234
- * Checks if the provided value is an empty array.
235
- *
236
- * @param value - The value to check.
237
- * @returns True if the value is an empty array, false otherwise.
238
- *
239
- * @example
240
- * isEmptyArray([]); // true
241
- * isEmptyArray([1]); // false
242
- *
243
- * @category Arrays
244
- */
245
- const isEmptyArray = (value) => isArray(value) && value.length === 0;
246
- //#endregion
247
- //#region src/guards/isEmptyRecord.ts
248
- /**
249
- * Checks if the provided value is an object with no own properties.
250
- *
251
- * @param value - The value to check.
252
- * @returns True if the value is an empty object, false otherwise.
253
- *
254
- * @example
255
- * isEmptyRecord({}); // true
256
- * isEmptyRecord({ a: 1 }); // false
257
- *
258
- * @category Records
259
- */
260
- const isEmptyRecord = (value) => isRecord(value) && Object.keys(value).length === 0;
261
- //#endregion
262
- //#region src/guards/isString.ts
263
- /**
264
- * Checks if the provided value is a string.
265
- *
266
- * @param value - The value to check.
267
- * @returns True if the value is a string, false otherwise.
268
- *
269
- * @example
270
- * isString('hi'); // true
271
- * isString(42); // false
272
- *
273
- * @category Primitives
274
- */
275
- const isString = (value) => typeof value === "string";
276
- //#endregion
277
- //#region src/guards/isEmptyString.ts
278
- /**
279
- * Checks if the provided value is an empty string.
280
- *
281
- * @param value - The value to check.
282
- * @returns True if the value is an empty string, false otherwise.
283
- *
284
- * @example
285
- * isEmptyString(''); // true
286
- * isEmptyString('a'); // false
287
- *
288
- * @category Strings
289
- */
290
- const isEmptyString = (value) => isString(value) && value === "";
291
- //#endregion
292
- //#region src/guards/isError.ts
293
- /**
294
- * Checks if the provided value is an instance of Error.
295
- *
296
- * @param value - The value to check.
297
- * @returns True if the value is an Error instance, false otherwise.
298
- *
299
- * @remarks
300
- * Matches subclasses of `Error` too (e.g. `TypeError`, custom errors).
301
- *
302
- * @example
303
- * isError(new Error('boom')); // true
304
- * isError('boom'); // false
305
- *
306
- * @category Primitives
307
- */
308
- const isError = (value) => {
309
- return isNotNil(value) && value instanceof Error;
310
- };
311
- //#endregion
312
- //#region src/guards/_falsyValues.ts
313
- const FALSY_VALUES = [
314
- false,
315
- 0,
316
- -0,
317
- 0n,
318
- "",
319
- null,
320
- void 0,
321
- NaN
322
- ];
323
- //#endregion
324
- //#region src/guards/isFalsy.ts
325
- /**
326
- * Checks if the provided value is falsy.
327
- *
328
- * @param value - The value to check.
329
- * @returns True if the value is falsy, false otherwise.
330
- *
331
- * @remarks
332
- * Returns true for `false`, `0`, `-0`, `0n`, `''`, `null`, `undefined`,
333
- * and `NaN`.
334
- *
335
- * @example
336
- * isFalsy(0); // true
337
- * isFalsy(1); // false
338
- *
339
- * @category Truthy / falsy
340
- */
341
- const isFalsy = (value) => FALSY_VALUES.includes(value) || Number.isNaN(value);
342
- //#endregion
343
- //#region src/guards/isNumber.ts
344
- /**
345
- * Checks if the provided value is a number.
346
- *
347
- * @param value - The value to check.
348
- * @returns True if the value is a number, false otherwise.
349
- *
350
- * @remarks
351
- * `NaN` is a `number`, so `isNumber(NaN)` is true. Use `isInteger` or
352
- * combine with `!isNaN(value)` if you need a finite number.
353
- *
354
- * @example
355
- * isNumber(1); // true
356
- * isNumber('1'); // false
357
- *
358
- * @category Primitives
359
- */
360
- const isNumber = (value) => typeof value === "number";
361
- //#endregion
362
- //#region src/guards/isFiniteNumber.ts
363
- /**
364
- * Checks if the provided value is a finite number.
365
- *
366
- * @param value - The value to check.
367
- * @returns True if the value is a finite number, false otherwise.
368
- *
369
- * @example
370
- * isFiniteNumber(42); // true
371
- * isFiniteNumber(Infinity); // false
372
- *
373
- * @category Primitives
374
- */
375
- const isFiniteNumber = (value) => isNumber(value) && Number.isFinite(value);
376
- //#endregion
377
- //#region src/guards/isHtmlButtonElement.ts
378
- /**
379
- * Checks if the provided value is an HTMLButtonElement.
380
- *
381
- * @param value - The value to check.
382
- * @returns True if the value is an HTMLButtonElement, false otherwise.
383
- *
384
- * @example
385
- * isHtmlButtonElement(document.createElement('button')); // true
386
- * isHtmlButtonElement(document.createElement('div')); // false
387
- *
388
- * @category DOM
389
- */
390
- const isHtmlButtonElement = (value) => value instanceof HTMLButtonElement;
391
- //#endregion
392
- //#region src/guards/isHtmlElement.ts
393
- /**
394
- * Checks if the provided value is an HTMLElement.
395
- *
396
- * @param value - The value to check.
397
- * @returns True if the value is an HTMLElement, false otherwise.
398
- *
399
- * @example
400
- * isHtmlElement(document.body); // true
401
- * isHtmlElement('div'); // false
402
- *
403
- * @category DOM
404
- */
405
- const isHtmlElement = (value) => value instanceof HTMLElement;
406
- //#endregion
407
- //#region src/guards/isHtmlInputElement.ts
408
- /**
409
- * Checks if the provided value is an HTMLInputElement.
410
- *
411
- * @param value - The value to check.
412
- * @returns True if the value is an HTMLInputElement, false otherwise.
413
- *
414
- * @example
415
- * isHtmlInputElement(document.createElement('input')); // true
416
- * isHtmlInputElement(document.createElement('div')); // false
417
- *
418
- * @category DOM
419
- */
420
- const isHtmlInputElement = (value) => value instanceof HTMLInputElement;
421
- //#endregion
422
- //#region src/guards/isHtmlVideoElement.ts
423
- /**
424
- * Checks if the provided value is an HTMLVideoElement.
425
- *
426
- * @param value - The value to check.
427
- * @returns True if the value is an HTMLVideoElement, false otherwise.
428
- *
429
- * @example
430
- * isHtmlVideoElement(document.createElement('video')); // true
431
- * isHtmlVideoElement(document.createElement('div')); // false
432
- *
433
- * @category DOM
434
- */
435
- const isHtmlVideoElement = (value) => value instanceof HTMLVideoElement;
436
- //#endregion
437
- //#region src/guards/isInteger.ts
438
- /**
439
- * Checks if the provided value is an integer.
440
- *
441
- * @param value - The value to check.
442
- * @returns True if the value is an integer, false otherwise.
443
- *
444
- * @remarks
445
- * Uses `Number.isInteger`, so non-finite values (`NaN`, `Infinity`)
446
- * return false.
447
- *
448
- * @example
449
- * isInteger(5); // true
450
- * isInteger(5.5); // false
451
- *
452
- * @category Primitives
453
- */
454
- const isInteger = (value) => Number.isInteger(value);
455
- //#endregion
456
- //#region src/guards/isIterable.ts
457
- /**
458
- * Checks if the provided value implements the iterable protocol.
459
- *
460
- * @param value - The value to check.
461
- * @returns True if the value is iterable, false otherwise.
462
- *
463
- * @remarks
464
- * Strings are iterable and return true. Plain objects without
465
- * `Symbol.iterator` return false.
466
- *
467
- * @example
468
- * isIterable([1, 2, 3]); // true
469
- * isIterable({}); // false
470
- *
471
- * @category Primitives
472
- */
473
- const isIterable = (value) => {
474
- if (!isNotNil(value)) return false;
475
- return typeof value[Symbol.iterator] === "function";
476
- };
477
- //#endregion
478
- //#region src/guards/isMap.ts
479
- /**
480
- * Checks if the provided value is an instance of Map.
481
- *
482
- * @param value - The value to check.
483
- * @returns True if the value is a Map instance, false otherwise.
484
- *
485
- * @remarks
486
- * WeakMap instances return false.
487
- *
488
- * @example
489
- * isMap(new Map()); // true
490
- * isMap({}); // false
491
- *
492
- * @category Primitives
493
- */
494
- const isMap = (value) => {
495
- return isNotNil(value) && value instanceof Map;
496
- };
497
- //#endregion
498
- //#region src/guards/isMouseEvent.ts
499
- /**
500
- * Checks if the provided value is a MouseEvent.
501
- *
502
- * @param value - The value to check.
503
- * @returns True if the value is a MouseEvent, false otherwise.
504
- *
505
- * @example
506
- * isMouseEvent(new MouseEvent('click')); // true
507
- * isMouseEvent(new Event('change')); // false
508
- *
509
- * @category DOM
510
- */
511
- const isMouseEvent = (value) => value instanceof MouseEvent;
512
- //#endregion
513
- //#region src/guards/isNaN.ts
514
- /**
515
- * Checks if the provided value is NaN (Not a Number).
516
- *
517
- * @param value - The value to check.
518
- * @returns True if the value is NaN, false otherwise.
519
- *
520
- * @remarks
521
- * Uses `Number.isNaN` (not the coercive global `isNaN`), so only the
522
- * literal `NaN` value returns true.
523
- *
524
- * @example
525
- * isNaN(Number.NaN); // true
526
- * isNaN(0); // false
527
- *
528
- * @category Primitives
529
- */
530
- const isNaN = (value) => Number.isNaN(value);
531
- //#endregion
532
- //#region src/guards/isNonBlankString.ts
533
- /**
534
- * Checks if the provided value is a non-blank string (not empty and not whitespace-only).
535
- * Use {@link isNonEmptyString} when whitespace-only strings are acceptable (e.g. preserving
536
- * intentional formatting).
537
- *
538
- * @param value - The value to check.
539
- * @returns True if the value is a string with at least one non-whitespace character, false otherwise.
540
- *
541
- * @example
542
- * isNonBlankString('a'); // true
543
- * isNonBlankString(' '); // false
544
- *
545
- * @category Strings
546
- */
547
- const isNonBlankString = (value) => isString(value) && value.trim() !== "";
548
- //#endregion
549
- //#region src/guards/isNonEmptyArray.ts
550
- /**
551
- * Checks if the provided value is a non-empty array.
552
- *
553
- * @param value - The value to check. Can be null or undefined.
554
- * @returns True if the value is a non-empty array, false otherwise.
555
- *
556
- * @example
557
- * isNonEmptyArray([1]); // true
558
- * isNonEmptyArray([]); // false
559
- *
560
- * @category Arrays
561
- */
562
- const isNonEmptyArray = (value) => isArray(value) && value.length > 0;
563
- //#endregion
564
- //#region src/guards/isNonEmptyString.ts
565
- /**
566
- * Checks if the provided value is a non-empty string. Whitespace-only strings like `" "` pass.
567
- * Use {@link isNonBlankString} when whitespace-only strings should be rejected (e.g. user input
568
- * validation).
569
- *
570
- * @param value - The value to check.
571
- * @returns True if the value is a non-empty string, false otherwise.
572
- *
573
- * @example
574
- * isNonEmptyString('a'); // true
575
- * isNonEmptyString(''); // false
576
- *
577
- * @category Strings
578
- */
579
- const isNonEmptyString = (value) => isString(value) && !isEmptyString(value);
580
- //#endregion
581
- //#region src/guards/isNonNaNNumber.ts
582
- /**
583
- * Checks if the provided value is a number that is not NaN.
584
- *
585
- * @param value - The value to check.
586
- * @returns True if the value is a number and not NaN, false otherwise.
587
- *
588
- * @example
589
- * isNonNaNNumber(42); // true
590
- * isNonNaNNumber(Number.NaN); // false
591
- *
592
- * @category Primitives
593
- */
594
- const isNonNaNNumber = (value) => isNumber(value) && !isNaN(value);
595
- //#endregion
596
- //#region src/guards/isNotArray.ts
597
- /**
598
- * Checks if the provided value is not an array.
599
- *
600
- * @param value - The value to check.
601
- * @returns True if the value is not an array, false otherwise.
602
- *
603
- * @example
604
- * isNotArray('x'); // true
605
- * isNotArray([]); // false
606
- *
607
- * @category Negated
608
- */
609
- const isNotArray = (value) => !isArray(value);
610
- //#endregion
611
- //#region src/guards/isNotBoolean.ts
612
- /**
613
- * Checks if the provided value is not a boolean.
614
- *
615
- * @param value - The value to check.
616
- * @returns True if the value is not a boolean, false otherwise.
617
- *
618
- * @example
619
- * isNotBoolean(1); // true
620
- * isNotBoolean(true); // false
621
- *
622
- * @category Negated
623
- */
624
- const isNotBoolean = (value) => !isBoolean(value);
625
- //#endregion
626
- //#region src/guards/isNotFunction.ts
627
- /**
628
- * Checks if the provided value is not a function.
629
- *
630
- * @param value - The value to check.
631
- * @returns True if the value is not a function, false otherwise.
632
- *
633
- * @example
634
- * isNotFunction(1); // true
635
- * isNotFunction(() => {}); // false
636
- *
637
- * @category Negated
638
- */
639
- const isNotFunction = (value) => !isFunction(value);
640
- //#endregion
641
- //#region src/guards/isNotNull.ts
642
- /**
643
- * Checks if the provided value is not null.
644
- *
645
- * @param value - The value to check.
646
- * @returns True if the value is not null, false otherwise.
647
- *
648
- * @example
649
- * isNotNull(undefined); // true
650
- * isNotNull(null); // false
651
- *
652
- * @category Negated
653
- */
654
- const isNotNull = (value) => !isNull(value);
655
- //#endregion
656
- //#region src/guards/isNotNumber.ts
657
- /**
658
- * Checks if the provided value is not a number.
659
- *
660
- * @param value - The value to check.
661
- * @returns True if the value is not a number, false otherwise.
662
- *
663
- * @example
664
- * isNotNumber('1'); // true
665
- * isNotNumber(1); // false
666
- *
667
- * @category Negated
668
- */
669
- const isNotNumber = (value) => !isNumber(value);
670
- //#endregion
671
- //#region src/guards/isNotRecord.ts
672
- /**
673
- * Checks if the provided value is not an object.
674
- *
675
- * @param value - The value to check.
676
- * @returns True if the value is not a record (object), false otherwise.
677
- *
678
- * @example
679
- * isNotRecord([]); // true
680
- * isNotRecord({}); // false
681
- *
682
- * @category Negated
683
- */
684
- const isNotRecord = (value) => !isRecord(value);
685
- //#endregion
686
- //#region src/guards/isNotString.ts
687
- /**
688
- * Checks if the provided value is not a string.
689
- *
690
- * @param value - The value to check.
691
- * @returns True if the value is not a string, false otherwise.
692
- *
693
- * @example
694
- * isNotString(1); // true
695
- * isNotString('a'); // false
696
- *
697
- * @category Negated
698
- */
699
- const isNotString = (value) => !isString(value);
700
- //#endregion
701
- //#region src/guards/isNotUndefined.ts
702
- /**
703
- * Checks if the provided value is not undefined.
704
- *
705
- * @param value - The value to check.
706
- * @returns True if the value is not undefined, false otherwise.
707
- *
708
- * @example
709
- * isNotUndefined(null); // true
710
- * isNotUndefined(undefined); // false
711
- *
712
- * @category Negated
713
- */
714
- const isNotUndefined = (value) => !isUndefined(value);
715
- //#endregion
716
- //#region src/guards/isVoid.ts
717
- /**
718
- * Checks if the provided value is void.
719
- *
720
- * @param value - The value to check.
721
- * @returns True if the value is void (undefined), false otherwise.
722
- *
723
- * @example
724
- * isVoid(undefined); // true
725
- * isVoid(0); // false
726
- *
727
- * @category Primitives
728
- */
729
- const isVoid = (value) => value === void 0;
730
- //#endregion
731
- //#region src/guards/isNotVoid.ts
732
- /**
733
- * Checks if the provided value is not void.
734
- *
735
- * @param value - The value to check.
736
- * @returns True if the value is not void (defined), false otherwise.
737
- *
738
- * @example
739
- * isNotVoid(0); // true
740
- * isNotVoid(undefined); // false
741
- *
742
- * @category Negated
743
- */
744
- const isNotVoid = (value) => !isVoid(value);
745
- //#endregion
746
- //#region src/guards/isPlainObject.ts
747
- /**
748
- * Checks if the provided value is a plain object created with `{}` or `Object.create(null)`.
749
- * Returns false for arrays, `Date`, `Map`, `RegExp`, boxed primitives, and class instances.
750
- *
751
- * @param value - The value to check.
752
- * @returns True if the value is a plain object, false otherwise.
753
- *
754
- * @example
755
- * isPlainObject({}); // true
756
- * isPlainObject(new Date()); // false
757
- *
758
- * @category Records
759
- */
760
- const isPlainObject = (value) => {
761
- if (isNil(value) || typeof value !== "object") return false;
762
- if (isArray(value)) return false;
763
- const proto = Object.getPrototypeOf(value);
764
- return proto === Object.prototype || proto === null;
765
- };
766
- //#endregion
767
- //#region src/guards/isPromise.ts
768
- /**
769
- * Checks if the provided value is a Promise, including promise-like objects
770
- * that implement `then`, `catch`, and `finally`.
771
- *
772
- * @param value - The value to check.
773
- * @returns True if the value is a Promise or promise-like object, false otherwise.
774
- *
775
- * @remarks
776
- * The full `Promise` method surface is required so the narrowed type is
777
- * accurate: `then`, `catch`, and `finally` must all be functions. Thenables
778
- * that only implement a subset are rejected.
779
- *
780
- * @example
781
- * isPromise(Promise.resolve()); // true
782
- * isPromise({ then: () => 1 }); // false
783
- *
784
- * @category Primitives
785
- */
786
- const isPromise = (value) => {
787
- if (!isNotNil(value)) return false;
788
- const candidate = value;
789
- return typeof candidate.then === "function" && typeof candidate.catch === "function" && typeof candidate.finally === "function";
790
- };
791
- //#endregion
792
- //#region src/guards/isRegExp.ts
793
- /**
794
- * Checks if the provided value is an instance of RegExp.
795
- *
796
- * @param value - The value to check.
797
- * @returns True if the value is a RegExp instance, false otherwise.
798
- *
799
- * @example
800
- * isRegExp(/abc/); // true
801
- * isRegExp('/abc/'); // false
802
- *
803
- * @category Primitives
804
- */
805
- const isRegExp = (value) => {
806
- return isNotNil(value) && value instanceof RegExp;
807
- };
808
- //#endregion
809
- //#region src/guards/isSet.ts
810
- /**
811
- * Checks if the provided value is an instance of Set.
812
- *
813
- * @param value - The value to check.
814
- * @returns True if the value is a Set instance, false otherwise.
815
- *
816
- * @remarks
817
- * WeakSet instances return false.
818
- *
819
- * @example
820
- * isSet(new Set()); // true
821
- * isSet([]); // false
822
- *
823
- * @category Primitives
824
- */
825
- const isSet = (value) => {
826
- return isNotNil(value) && value instanceof Set;
827
- };
828
- //#endregion
829
- //#region src/guards/isSvgElement.ts
830
- /**
831
- * Checks if the provided value is an SVGElement.
832
- *
833
- * @param value - The value to check.
834
- * @returns True if the value is an SVGElement, false otherwise.
835
- *
836
- * @example
837
- * isSvgElement(document.createElementNS('http://www.w3.org/2000/svg', 'svg')); // true
838
- * isSvgElement(document.createElement('div')); // false
839
- *
840
- * @category DOM
841
- */
842
- const isSvgElement = (value) => value instanceof SVGElement;
843
- //#endregion
844
- //#region src/guards/isSymbol.ts
845
- /**
846
- * Checks if the provided value is a symbol.
847
- *
848
- * @param value - The value to check.
849
- * @returns True if the value is a symbol, false otherwise.
850
- *
851
- * @example
852
- * isSymbol(Symbol('a')); // true
853
- * isSymbol('symbol'); // false
854
- *
855
- * @category Primitives
856
- */
857
- const isSymbol = (value) => typeof value === "symbol";
858
- //#endregion
859
- //#region src/guards/isTextNode.ts
860
- /**
861
- * Checks if the provided value is a Text node.
862
- *
863
- * @param value - The value to check.
864
- * @returns True if the value is a Text node, false otherwise.
865
- *
866
- * @example
867
- * isTextNode(document.createTextNode('hi')); // true
868
- * isTextNode(document.createElement('div')); // false
869
- *
870
- * @category DOM
871
- */
872
- const isTextNode = (value) => value.nodeName === "#text";
873
- //#endregion
874
- //#region src/guards/isTruthy.ts
875
- /**
876
- * Checks if the provided value is truthy.
877
- *
878
- * @param value - The value to check.
879
- * @returns True if the value is truthy, false otherwise.
880
- *
881
- * @remarks
882
- * The complement of `isFalsy`. Does not provide narrowing on its own;
883
- * use `isNotNil` or a specific positive guard when narrowing matters.
884
- *
885
- * @example
886
- * isTruthy(1); // true
887
- * isTruthy(0); // false
888
- *
889
- * @category Truthy / falsy
890
- */
891
- const isTruthy = (value) => !FALSY_VALUES.includes(value) && !Number.isNaN(value);
892
- //#endregion
893
- //#region src/guards/isWeakMap.ts
894
- /**
895
- * Checks if the provided value is an instance of WeakMap.
896
- *
897
- * @param value - The value to check.
898
- * @returns True if the value is a WeakMap instance, false otherwise.
899
- *
900
- * @remarks
901
- * Map instances return false. Narrows to `WeakMap<WeakKey, unknown>`, since
902
- * weak collections accept non-registered symbols as keys (ES2023).
903
- *
904
- * @example
905
- * isWeakMap(new WeakMap()); // true
906
- * isWeakMap(new Map()); // false
907
- *
908
- * @category Primitives
909
- */
910
- const isWeakMap = (value) => {
911
- return isNotNil(value) && value instanceof WeakMap;
912
- };
913
- //#endregion
914
- //#region src/guards/isWeakSet.ts
915
- /**
916
- * Checks if the provided value is an instance of WeakSet.
917
- *
918
- * @param value - The value to check.
919
- * @returns True if the value is a WeakSet instance, false otherwise.
920
- *
921
- * @remarks
922
- * Set instances return false. Narrows to `WeakSet<WeakKey>`, since weak
923
- * collections accept non-registered symbols as members (ES2023).
924
- *
925
- * @example
926
- * isWeakSet(new WeakSet()); // true
927
- * isWeakSet(new Set()); // false
928
- *
929
- * @category Primitives
930
- */
931
- const isWeakSet = (value) => {
932
- return isNotNil(value) && value instanceof WeakSet;
933
- };
934
- //#endregion
935
- //#region src/guards/readonlyArrayIncludes.ts
936
- /**
937
- * Checks if a readonly array includes the given element, with type narrowing.
938
- *
939
- * @param arr - The readonly array to search.
940
- * @param elem - The element to search for.
941
- * @returns True if the array includes the element, false otherwise.
942
- *
943
- * @example
944
- * const arr = ['a', 'b'] as const;
945
- * readonlyArrayIncludes(arr, 'a'); // true
946
- * readonlyArrayIncludes(arr, 'z'); // false
947
- *
948
- * @category Arrays
949
- */
950
- const readonlyArrayIncludes = (arr, elem) => arr.includes(elem);
951
- //#endregion
952
- //#region src/utilities/asyncNoOpFn.ts
953
- /**
954
- * An async function that does nothing. Useful as a default or placeholder
955
- * callback where a promise is expected.
956
- *
957
- * @returns A promise that resolves to `undefined`.
958
- *
959
- * @example
960
- * await asyncNoOpFn(); // undefined
961
- */
962
- const asyncNoOpFn = async () => {};
963
- //#endregion
964
- //#region src/utilities/_constants.ts
965
- const defaultLocales = ["en-US"];
966
- const defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
967
- const milisecondsInSecond = 1e3;
968
- const millisecondsInDay = 86400 * milisecondsInSecond;
969
- //#endregion
970
- //#region src/utilities/buildTimeDuration.ts
971
- /**
972
- * Returns an object representing a duration in seconds, minutes and hours.
973
- *
974
- * @param numberOfMilliseconds - The duration in milliseconds.
975
- * @returns The duration split into hours, minutes and seconds.
976
- *
977
- * @example
978
- * buildTimeDuration(3723000); // { hours: 1, minutes: 2, seconds: 3 }
979
- */
980
- const buildTimeDuration = (numberOfMilliseconds) => {
981
- const numberOfSeconds = Math.floor(numberOfMilliseconds / milisecondsInSecond);
982
- const numberOfMinutes = Math.floor(numberOfSeconds / 60);
983
- const numberOfHours = Math.floor(numberOfMinutes / 60);
984
- return {
985
- seconds: numberOfSeconds - numberOfMinutes * 60,
986
- minutes: numberOfMinutes - numberOfHours * 60,
987
- hours: numberOfHours
988
- };
989
- };
990
- //#endregion
991
- //#region src/utilities/coerceToBoolean.ts
992
- /**
993
- * Converts the boolean string values 'true' and 'false' into the
994
- * corresponding boolean. Any other value is coerced with `Boolean()`.
995
- *
996
- * @param value - The value to coerce.
997
- * @returns The value as a boolean.
998
- *
999
- * @example
1000
- * coerceToBoolean('true'); // true
1001
- * coerceToBoolean('false'); // false
1002
- * coerceToBoolean(0); // false
1003
- */
1004
- const coerceToBoolean = (value) => {
1005
- if (value === "true" || value === "false") return value === "true";
1006
- return Boolean(value);
1007
- };
1008
- //#endregion
1009
- //#region src/utilities/_isInvalidDate.ts
1010
- /**
1011
- * Checks whether a value is not a usable Date. Note that the Unix epoch
1012
- * (getTime() === 0) is treated as invalid.
1013
- *
1014
- * @param date - The value to check.
1015
- * @returns True if the value is not a Date, is an invalid Date, or is the Unix epoch.
1016
- */
1017
- const isInvalidDate = (date) => {
1018
- if (!isDate(date)) return true;
1019
- const time = date.getTime();
1020
- return time === 0 || Number.isNaN(time);
1021
- };
1022
- //#endregion
1023
- //#region src/utilities/dateOnlyISOString.ts
1024
- /**
1025
- * Converts a Date object into a date only string formatted to ISO 8601,
1026
- * e.g. '2021-06-03'.
1027
- *
1028
- * @param date - The Date to format; gracefully handles any value.
1029
- * @param options - Formatting options.
1030
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1031
- * @returns The formatted date string, or '' for invalid input.
1032
- *
1033
- * @example
1034
- * dateOnlyISOString(new Date(2011, 11, 15)); // '2011-12-15'
1035
- */
1036
- const dateOnlyISOString = (date, { timeZone = defaultTimeZone } = {}) => {
1037
- if (!isDate(date) || isInvalidDate(date)) return "";
1038
- try {
1039
- const partsAsObject = new Intl.DateTimeFormat(defaultLocales, {
1040
- year: "numeric",
1041
- month: "2-digit",
1042
- day: "2-digit",
1043
- timeZone
1044
- }).formatToParts(date).reduce((map, obj) => {
1045
- map[obj.type] = obj.value;
1046
- return map;
1047
- }, {});
1048
- return `${partsAsObject.year}-${partsAsObject.month}-${partsAsObject.day}`;
1049
- } catch (error) {
1050
- console.error(error);
1051
- return "";
1052
- }
1053
- };
1054
- //#endregion
1055
- //#region src/utilities/dateOnlyString.ts
1056
- /**
1057
- * Converts a Date object into a date only string, e.g. 'Jun 3, 2021',
1058
- * or 'Jun 3' if omitYear is true. Formats with the en-US locale.
1059
- *
1060
- * @param date - The Date to format; gracefully handles any value.
1061
- * @param options - Formatting options.
1062
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1063
- * @param options.omitYear - If true, display the date without the year.
1064
- * @returns The formatted date string, or '' for invalid input.
1065
- *
1066
- * @example
1067
- * dateOnlyString(new Date(2011, 11, 15)); // 'Dec 15, 2011'
1068
- */
1069
- const dateOnlyString = (date, { timeZone = defaultTimeZone, omitYear = false } = {}) => {
1070
- if (!isDate(date) || isInvalidDate(date)) return "";
1071
- const formatOptions = omitYear ? {
1072
- month: "short",
1073
- day: "numeric",
1074
- timeZone
1075
- } : {
1076
- dateStyle: "medium",
1077
- timeZone
1078
- };
1079
- try {
1080
- return new Intl.DateTimeFormat(defaultLocales, formatOptions).format(date);
1081
- } catch (error) {
1082
- console.error(error);
1083
- return "";
1084
- }
1085
- };
1086
- //#endregion
1087
- //#region src/utilities/dateOnlyStringForSentence.ts
1088
- /**
1089
- * Converts a Date object into a date only string for use in a sentence,
1090
- * e.g. 'June 3, 2021'. Formats with the en-US locale.
1091
- *
1092
- * @param date - The Date to format; gracefully handles any value.
1093
- * @param options - Formatting options.
1094
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1095
- * @returns The formatted date string, or '' for invalid input.
1096
- *
1097
- * @example
1098
- * dateOnlyStringForSentence(new Date(2011, 11, 15)); // 'December 15, 2011'
1099
- */
1100
- const dateOnlyStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
1101
- if (!isDate(date) || isInvalidDate(date)) return "";
1102
- try {
1103
- return new Intl.DateTimeFormat(defaultLocales, {
1104
- dateStyle: "long",
1105
- timeZone
1106
- }).format(date);
1107
- } catch (error) {
1108
- console.error(error);
1109
- return "";
1110
- }
1111
- };
1112
- //#endregion
1113
- //#region src/utilities/dateOnlyStringNumeric.ts
1114
- /**
1115
- * Converts a Date object into a date only string formatted numerically,
1116
- * e.g. '06/03/2021'. Formats with the en-US locale.
1117
- *
1118
- * @param date - The Date to format; gracefully handles any value.
1119
- * @param options - Formatting options.
1120
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1121
- * @returns The formatted date string, or '' for invalid input.
1122
- *
1123
- * @example
1124
- * dateOnlyStringNumeric(new Date(2011, 11, 15)); // '12/15/2011'
1125
- */
1126
- const dateOnlyStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
1127
- if (!isDate(date) || isInvalidDate(date)) return "";
1128
- try {
1129
- return new Intl.DateTimeFormat(defaultLocales, {
1130
- year: "numeric",
1131
- month: "2-digit",
1132
- day: "2-digit",
1133
- timeZone
1134
- }).format(date);
1135
- } catch (error) {
1136
- console.error(error);
1137
- return "";
1138
- }
1139
- };
1140
- //#endregion
1141
- //#region src/utilities/dateTimeToDate.ts
1142
- /**
1143
- * Converts a plain object of date and time parts into a Date object.
1144
- *
1145
- * @param dateTime - The date parts to convert.
1146
- * @returns The converted Date, or null if year, month, or dayOfMonth is missing.
1147
- *
1148
- * @example
1149
- * dateTimeToDate({ year: 2015, month: 10, dayOfMonth: 7, hours: 4, minutes: 15 });
1150
- * // new Date(2015, 10, 7, 4, 15)
1151
- */
1152
- const dateTimeToDate = (dateTime) => {
1153
- const { year, month, dayOfMonth, hours, minutes } = dateTime ?? {};
1154
- if (year !== void 0 && month !== void 0 && dayOfMonth !== void 0) return new Date(year, month, dayOfMonth, hours ?? 0, minutes ?? 0);
1155
- return null;
1156
- };
1157
- //#endregion
1158
- //#region src/utilities/dateTimeToISO.ts
1159
- /**
1160
- * Converts a plain object of date and time parts into an ISO-8601 string.
1161
- *
1162
- * @param dateTime - The date parts to convert.
1163
- * @returns The ISO-8601 string, or null if year, month, or dayOfMonth is missing.
1164
- *
1165
- * @example
1166
- * dateTimeToISO({ year: 2015, month: 10, dayOfMonth: 7, hours: 4, minutes: 15 });
1167
- * // '2015-11-07T04:15:00.000Z' (in UTC)
1168
- */
1169
- const dateTimeToISO = (dateTime) => dateTimeToDate(dateTime)?.toISOString() ?? null;
1170
- //#endregion
1171
- //#region src/utilities/dateToDateTime.ts
1172
- /**
1173
- * Converts a Date object into a plain object of its local date and time parts.
1174
- *
1175
- * @param date - The Date object to convert.
1176
- * @returns The date parts, or null if the value is not a Date.
1177
- *
1178
- * @example
1179
- * dateToDateTime(new Date(2011, 11, 15, 3, 10));
1180
- * // { year: 2011, month: 11, dayOfMonth: 15, hours: 3, minutes: 10 }
1181
- */
1182
- const dateToDateTime = (date) => {
1183
- if (!isDate(date)) return null;
1184
- return {
1185
- year: date.getFullYear(),
1186
- month: date.getMonth(),
1187
- dayOfMonth: date.getDate(),
1188
- hours: date.getHours(),
1189
- minutes: date.getMinutes()
1190
- };
1191
- };
1192
- //#endregion
1193
- //#region src/utilities/dateTimeRounded.ts
1194
- /**
1195
- * Rounds a Date up to the next half hour boundary.
1196
- *
1197
- * @param dateTime - The Date to round.
1198
- * @param toISOString - Whether to return an ISO-8601 string instead of a Date.
1199
- * @returns The rounded value as a string or Date depending on toISOString.
1200
- *
1201
- * @example
1202
- * dateTimeRounded(new Date(2015, 10, 7, 0, 10)); // '2015-11-07T00:30:00.000Z' (in UTC)
1203
- * dateTimeRounded(new Date(2015, 10, 7, 0, 40), false); // new Date(2015, 10, 7, 1, 0)
1204
- */
1205
- const dateTimeRounded = (dateTime, toISOString = true) => {
1206
- const first30Min = dateTime.getMinutes() <= 30;
1207
- const hours = first30Min ? dateTime.getHours() : dateTime.getHours() + 1;
1208
- const minutes = first30Min ? 30 : 0;
1209
- const dateWithTime = {
1210
- ...dateToDateTime(dateTime),
1211
- hours,
1212
- minutes
1213
- };
1214
- if (toISOString) return dateTimeToISO(dateWithTime);
1215
- return dateTimeToDate(dateWithTime);
1216
- };
1217
- //#endregion
1218
- //#region src/utilities/dateTimeString.ts
1219
- /**
1220
- * Converts a Date, timestamp, or date string into a date and time string,
1221
- * e.g. 'Jun 3, 2021, 11:52 AM'. Formats with the en-US locale.
1222
- *
1223
- * NOTE: you should probably use timeAgoString when trying to display
1224
- * an updated/created timestamp.
1225
- *
1226
- * @param date - The Date, timestamp, or date string to format; gracefully handles any value.
1227
- * @param options - Formatting options.
1228
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1229
- * @param options.omitYear - If true, display the date without the year.
1230
- * @returns The formatted date string, or '' for invalid input.
1231
- *
1232
- * @example
1233
- * dateTimeString(new Date(2011, 11, 15, 7, 30)); // 'Dec 15, 2011, 7:30 AM'
1234
- */
1235
- const dateTimeString = (date, { timeZone = defaultTimeZone, omitYear = false } = {}) => {
1236
- if (isNil(date)) return "";
1237
- const formattedDate = new Date(date);
1238
- if (isInvalidDate(formattedDate)) return "";
1239
- try {
1240
- const baseOptions = {
1241
- month: "short",
1242
- day: "numeric",
1243
- hour: "numeric",
1244
- minute: "2-digit",
1245
- timeZone
1246
- };
1247
- const options = omitYear ? baseOptions : {
1248
- ...baseOptions,
1249
- year: "numeric"
1250
- };
1251
- return formattedDate.toLocaleDateString(defaultLocales, options);
1252
- } catch (error) {
1253
- console.error(error);
1254
- return "";
1255
- }
1256
- };
1257
- //#endregion
1258
- //#region src/utilities/dateTimeStringForSentence.ts
1259
- /**
1260
- * Converts a Date object into a date and time string for use in a sentence,
1261
- * e.g. 'June 3, 2021, 11:52 AM'. Formats with the en-US locale.
1262
- *
1263
- * NOTE: you should probably use timeAgoString when trying to display
1264
- * an updated/created timestamp.
1265
- *
1266
- * @param date - The Date to format; gracefully handles any value.
1267
- * @param options - Formatting options.
1268
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1269
- * @returns The formatted date string, or '' for invalid input.
1270
- *
1271
- * @example
1272
- * dateTimeStringForSentence(new Date(2011, 11, 15, 7, 30)); // 'December 15, 2011, 7:30 AM'
1273
- */
1274
- const dateTimeStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
1275
- if (!isDate(date) || isInvalidDate(date)) return "";
1276
- try {
1277
- const { year, month, day, hour, minute, dayPeriod } = new Intl.DateTimeFormat(defaultLocales, {
1278
- month: "long",
1279
- day: "numeric",
1280
- year: "numeric",
1281
- hour: "numeric",
1282
- minute: "2-digit",
1283
- timeZone
1284
- }).formatToParts(date).reduce((acc, part) => {
1285
- if (part.type !== "literal") acc[part.type] = part.value;
1286
- return acc;
1287
- }, {});
1288
- return `${month} ${day}, ${year}, ${hour}:${minute} ${dayPeriod}`;
1289
- } catch (error) {
1290
- console.error(error);
1291
- return "";
1292
- }
1293
- };
1294
- //#endregion
1295
- //#region src/utilities/dateUTCOffset.ts
1296
- /**
1297
- * Given a date, shows the UTC offset of the current time zone, e.g. '+02:00'.
1298
- *
1299
- * @param date - The Date to calculate the offset for.
1300
- * @returns The UTC offset string.
1301
- *
1302
- * @example
1303
- * dateUTCOffset(new Date(2011, 11, 15)); // '+00:00' (when run in UTC)
1304
- */
1305
- const dateUTCOffset = (date) => {
1306
- const offsetInHours = date.getTimezoneOffset() / 60 * -1;
1307
- const hours = Math.round(offsetInHours);
1308
- const minutes = (offsetInHours - hours) * 60;
1309
- return `${hours >= 0 ? "+" : ""}${`${hours}`.padStart(2, "0")}:${`${minutes}`.padStart(2, "0")}`;
1310
- };
1311
- //#endregion
1312
- //#region src/utilities/dayOfWeekString.ts
1313
- /**
1314
- * Converts a Date object into a day of the week string, e.g. 'Thursday'.
1315
- * Formats with the en-US locale.
1316
- *
1317
- * @param date - The Date to format.
1318
- * @param options - Formatting options.
1319
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1320
- * @returns The formatted day of the week, or '' for null or invalid input.
1321
- *
1322
- * @example
1323
- * dayOfWeekString(new Date(2011, 11, 15)); // 'Thursday'
1324
- */
1325
- const dayOfWeekString = (date, { timeZone = defaultTimeZone } = {}) => {
1326
- if (date === null) return "";
1327
- try {
1328
- return new Intl.DateTimeFormat(defaultLocales, {
1329
- weekday: "long",
1330
- timeZone
1331
- }).format(date);
1332
- } catch (error) {
1333
- console.error(error);
1334
- return "";
1335
- }
1336
- };
1337
- //#endregion
1338
- //#region src/utilities/deepMerge.ts
1339
- const UNSAFE_KEYS = /* @__PURE__ */ new Set([
1340
- "__proto__",
1341
- "constructor",
1342
- "prototype"
1343
- ]);
1344
- const cloneIfArray = (value) => isArray(value) ? [...value] : value;
1345
- /**
1346
- * Deeply merges objects without mutating them, inferring the return type from
1347
- * the inputs. Plain objects are merged recursively, arrays are concatenated
1348
- * with duplicate items removed (by reference for object items), and all other
1349
- * values (including class instances) are overwritten in the order of the
1350
- * provided arguments. The prototype-polluting keys `__proto__`, `constructor`,
1351
- * and `prototype` are dropped. Symbol-keyed properties are not merged.
1352
- *
1353
- * @param objects - The objects to merge.
1354
- * @returns A new object containing the merged result.
1355
- * @throws TypeError when an argument is an array.
1356
- *
1357
- * @example
1358
- * deepMerge({ a: { b: 1 }, c: [1] }, { a: { d: 2 }, c: [2] });
1359
- * // { a: { b: 1, d: 2 }, c: [1, 2] }
1360
- */
1361
- const deepMerge = (...objects) => {
1362
- const result = {};
1363
- for (const current of objects) {
1364
- if (isArray(current)) throw new TypeError("Arguments provided to deepMerge must be objects, not arrays.");
1365
- const safeKeys = Object.keys(current).filter((key) => !UNSAFE_KEYS.has(key));
1366
- for (const key of safeKeys) {
1367
- const existing = result[key];
1368
- const incoming = current[key];
1369
- if (isArray(existing) && isArray(incoming)) result[key] = [.../* @__PURE__ */ new Set([...existing, ...incoming])];
1370
- else if (isPlainObject(existing) && isPlainObject(incoming)) result[key] = deepMerge(existing, incoming);
1371
- else if (isPlainObject(incoming)) result[key] = deepMerge(incoming);
1372
- else result[key] = cloneIfArray(incoming);
1373
- }
1374
- }
1375
- return result;
1376
- };
1377
- //#endregion
1378
- //#region src/utilities/getObjectEntries.ts
1379
- /**
1380
- * Returns the entries of an object with strongly typed keys and values.
1381
- *
1382
- * @param obj - The object to get entries from.
1383
- * @returns An array of [key, value] tuples.
1384
- *
1385
- * @example
1386
- * getObjectEntries({ a: 1, b: 2 }); // [['a', 1], ['b', 2]]
1387
- */
1388
- const getObjectEntries = (obj) => Object.keys(obj).map((key) => [key, obj[key]]);
1389
- //#endregion
1390
- //#region src/utilities/getObjectKeys.ts
1391
- /**
1392
- * Returns the keys of an object with strongly typed key type.
1393
- *
1394
- * @param obj - The object to get keys from.
1395
- * @returns An array of the object's keys.
1396
- *
1397
- * @example
1398
- * getObjectKeys({ a: 1, b: 2 }); // ['a', 'b']
1399
- */
1400
- const getObjectKeys = (obj) => Object.keys(obj);
1401
- //#endregion
1402
- //#region src/utilities/getObjectValues.ts
1403
- /**
1404
- * Returns the values of an object with strongly typed value type.
1405
- *
1406
- * @param obj - The object to get values from.
1407
- * @returns An array of the object's values.
1408
- *
1409
- * @example
1410
- * getObjectValues({ a: 1, b: 2 }); // [1, 2]
1411
- */
1412
- const getObjectValues = (obj) => Object.values(obj);
1413
- //#endregion
1414
- //#region src/utilities/isEmail.ts
1415
- /**
1416
- * Loosely validates an email address string.
1417
- *
1418
- * @param value - The string to validate.
1419
- * @returns True if the string appears to be an email address, false otherwise.
1420
- *
1421
- * @example
1422
- * isEmail('user@example.com'); // true
1423
- * isEmail('user@example'); // false
1424
- */
1425
- const isEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
1426
- //#endregion
1427
- //#region src/utilities/isUrl.ts
1428
- /**
1429
- * Loosely validates a URL string.
1430
- *
1431
- * @param value - The value to validate.
1432
- * @returns True if the value appears to be a URL, false otherwise.
1433
- *
1434
- * @example
1435
- * isUrl('https://wistia.com'); // true
1436
- * isUrl('not a url'); // false
1437
- */
1438
- const isUrl = (value) => {
1439
- const protocolAndDomain = /^(?:\w+:)?\/\/(\S+)$/;
1440
- const localhostDomain = /^localhost[:?\d]*(?:[^:?\d]\S*)?$/;
1441
- const nonLocalhostDomain = /^[^\s.]+\.\S{2,}$/;
1442
- if (!isString(value)) return false;
1443
- const remaining = protocolAndDomain.exec(value)?.[1];
1444
- if (remaining === void 0) return false;
1445
- return localhostDomain.test(remaining) || nonLocalhostDomain.test(remaining);
1446
- };
1447
- //#endregion
1448
- //#region src/utilities/_padTimeInteger.ts
1449
- /**
1450
- * Pads an integer with a leading zero.
1451
- *
1452
- * @param num - The integer to pad.
1453
- * @returns The integer as a string with padding.
1454
- */
1455
- const padTimeInteger = (num) => num.toString().padStart(2, "0");
1456
- //#endregion
1457
- //#region src/utilities/mediaDurationString.ts
1458
- /**
1459
- * A string representation of a duration for a media. Assumes most medias
1460
- * are under an hour so only shows hours if media is over an hour.
1461
- *
1462
- * @param numberOfMilliseconds - The duration in milliseconds.
1463
- * @returns The formatted duration string.
1464
- *
1465
- * @example
1466
- * mediaDurationString(234230); // '3:54'
1467
- * mediaDurationString(23423000); // '6:30:23'
1468
- */
1469
- const mediaDurationString = (numberOfMilliseconds) => {
1470
- const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
1471
- if (hours < 1) return `${minutes}:${padTimeInteger(seconds)}`;
1472
- return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
1473
- };
1474
- //#endregion
1475
- //#region src/utilities/millisecondsToDurationISOString.ts
1476
- /**
1477
- * Given a number of milliseconds, returns the ISO 8601 duration string
1478
- * rounded down from the number of seconds.
1479
- *
1480
- * @param numberOfMilliseconds - The duration in milliseconds.
1481
- * @returns The ISO 8601 duration string.
1482
- *
1483
- * @example
1484
- * millisecondsToDurationISOString(33000); // 'PT33S'
1485
- * millisecondsToDurationISOString(3605000); // 'PT1H5S'
1486
- */
1487
- const millisecondsToDurationISOString = (numberOfMilliseconds) => {
1488
- const { seconds, minutes, hours } = buildTimeDuration(numberOfMilliseconds);
1489
- let string = "PT";
1490
- if (hours) string += `${hours}H`;
1491
- if (minutes) string += `${minutes}M`;
1492
- if (seconds) string += `${seconds}S`;
1493
- if (!(seconds || minutes || hours)) string += "0S";
1494
- return string;
1495
- };
1496
- //#endregion
1497
- //#region src/utilities/monthDayStringNumeric.ts
1498
- /**
1499
- * Converts a Date object into a month and day string formatted numerically,
1500
- * e.g. '06/03'. Formats with the en-US locale.
1501
- *
1502
- * @param date - The Date to format; gracefully handles any value.
1503
- * @param options - Formatting options.
1504
- * @param options.timeZone - The time zone to display the date in. Defaults to the current time zone.
1505
- * @returns The formatted date string, or '' for invalid input.
1506
- *
1507
- * @example
1508
- * monthDayStringNumeric(new Date(2011, 11, 15)); // '12/15'
1509
- */
1510
- const monthDayStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
1511
- if (!isDate(date) || isInvalidDate(date)) return "";
1512
- try {
1513
- return new Intl.DateTimeFormat(defaultLocales, {
1514
- month: "2-digit",
1515
- day: "2-digit",
1516
- timeZone
1517
- }).format(date);
1518
- } catch (error) {
1519
- console.error(error);
1520
- return "";
1521
- }
1522
- };
1523
- //#endregion
1524
- //#region src/utilities/noOpFn.ts
1525
- /**
1526
- * A function that does nothing. Useful as a default or placeholder callback.
1527
- *
1528
- * @returns Nothing.
1529
- *
1530
- * @example
1531
- * noOpFn(); // undefined
1532
- */
1533
- const noOpFn = () => {};
1534
- //#endregion
1535
- //#region src/utilities/noOpFnReturningFalse.ts
1536
- /**
1537
- * A function that does nothing and returns `false`. Useful as a default or
1538
- * placeholder callback where `false` is expected.
1539
- *
1540
- * @returns `false`.
1541
- *
1542
- * @example
1543
- * noOpFnReturningFalse(); // false
1544
- */
1545
- const noOpFnReturningFalse = () => false;
1546
- //#endregion
1547
- //#region src/utilities/noOpFnReturningNull.ts
1548
- /**
1549
- * A function that does nothing and returns `null`. Useful as a default or
1550
- * placeholder callback where `null` is expected.
1551
- *
1552
- * @returns `null`.
1553
- *
1554
- * @example
1555
- * noOpFnReturningNull(); // null
1556
- */
1557
- const noOpFnReturningNull = () => null;
1558
- //#endregion
1559
- //#region src/utilities/parseDateString.ts
1560
- const MONTH_NAMES = [
1561
- "January",
1562
- "February",
1563
- "March",
1564
- "April",
1565
- "May",
1566
- "June",
1567
- "July",
1568
- "August",
1569
- "September",
1570
- "October",
1571
- "November",
1572
- "December"
1573
- ];
1574
- const MONTH_ABBREVIATIONS = MONTH_NAMES.map((name) => name.slice(0, 3));
1575
- const startOfDay = (date) => {
1576
- const result = new Date(date);
1577
- result.setHours(0, 0, 0, 0);
1578
- return result;
1579
- };
1580
- const startOfToday = () => startOfDay(/* @__PURE__ */ new Date());
1581
- const startOfTomorrow = () => {
1582
- const tomorrow = startOfToday();
1583
- tomorrow.setDate(tomorrow.getDate() + 1);
1584
- return tomorrow;
1585
- };
1586
- const monthIndexIn = (names, value) => names.findIndex((name) => name.toLowerCase() === value.toLowerCase());
1587
- const toNumberOrUndefined = (value) => value === void 0 ? void 0 : Number(value);
1588
- const DATE_PATTERNS = [
1589
- {
1590
- regex: new RegExp(`^(${MONTH_ABBREVIATIONS.join("|")}) (\\d{1,2})(?:, (\\d{1,4}))?$`, "i"),
1591
- toParts: ([, month, day, year]) => ({
1592
- monthIndex: monthIndexIn(MONTH_ABBREVIATIONS, String(month)),
1593
- day: Number(day),
1594
- year: toNumberOrUndefined(year)
1595
- })
1596
- },
1597
- {
1598
- regex: new RegExp(`^(${MONTH_NAMES.join("|")}) (\\d{1,2})(?:, (\\d{1,4}))?$`, "i"),
1599
- toParts: ([, month, day, year]) => ({
1600
- monthIndex: monthIndexIn(MONTH_NAMES, String(month)),
1601
- day: Number(day),
1602
- year: toNumberOrUndefined(year)
1603
- })
1604
- },
1605
- {
1606
- regex: /^(\d{1,2})\/(\d{1,2})(?:\/(\d{1,4}))?$/,
1607
- toParts: ([, month, day, year]) => ({
1608
- monthIndex: Number(month) - 1,
1609
- day: Number(day),
1610
- year: toNumberOrUndefined(year)
1611
- })
1612
- },
1613
- {
1614
- regex: /^(\d{1,2})-(\d{1,2})(?:-(\d{1,4}))?$/,
1615
- toParts: ([, month, day, year]) => ({
1616
- monthIndex: Number(month) - 1,
1617
- day: Number(day),
1618
- year: toNumberOrUndefined(year)
1619
- })
1620
- },
1621
- {
1622
- regex: /^(\d{1,4})-(\d{1,2})-(\d{1,2})$/,
1623
- toParts: ([, year, month, day]) => ({
1624
- monthIndex: Number(month) - 1,
1625
- day: Number(day),
1626
- year: Number(year)
1627
- })
1628
- }
1629
- ];
1630
- const toValidDate = ({ monthIndex, day, year }, referenceDate) => {
1631
- if (year === 0) return null;
1632
- const resolvedYear = year ?? referenceDate.getFullYear();
1633
- const date = new Date(referenceDate.getFullYear(), 0, 1);
1634
- date.setFullYear(resolvedYear, monthIndex, day);
1635
- return date.getFullYear() === resolvedYear && date.getMonth() === monthIndex && date.getDate() === day ? date : null;
1636
- };
1637
- /**
1638
- * Loosely parses a human-entered date string into a Date at local midnight.
1639
- * Accepts 'today' and 'tomorrow', month name prefixes (resolved to the next
1640
- * 1st of that month), and common numeric and month-name formats, with a
1641
- * native Date fallback for anything else.
1642
- *
1643
- * @param str - The date string to parse.
1644
- * @returns The parsed Date at local midnight, or null if unparseable.
1645
- *
1646
- * @example
1647
- * parseDateString('Jan 5, 2025'); // Date for 2025-01-05 at local midnight
1648
- * parseDateString('garbage'); // null
1649
- */
1650
- const parseDateString = (str) => {
1651
- const trimmed = str.trim();
1652
- if (!trimmed) return null;
1653
- const lower = trimmed.toLowerCase();
1654
- if (lower === "today") return startOfToday();
1655
- if (lower === "tomorrow") return startOfTomorrow();
1656
- const monthIndex = MONTH_NAMES.findIndex((name) => name.toLowerCase().startsWith(lower));
1657
- if (monthIndex !== -1) {
1658
- const today = startOfToday();
1659
- let date = new Date(today.getFullYear(), monthIndex, 1);
1660
- if (date.getTime() < Date.now()) date = new Date(today.getFullYear() + 1, monthIndex, 1);
1661
- return date;
1662
- }
1663
- const referenceDate = /* @__PURE__ */ new Date();
1664
- for (const { regex, toParts } of DATE_PATTERNS) {
1665
- const match = trimmed.match(regex);
1666
- if (match) {
1667
- const parsed = toValidDate(toParts(match), referenceDate);
1668
- if (parsed !== null) return parsed;
1669
- }
1670
- }
1671
- const native = new Date(trimmed);
1672
- if (!Number.isNaN(native.getTime())) return startOfDay(native);
1673
- return null;
1674
- };
1675
- //#endregion
1676
- //#region src/utilities/sessionDurationString.ts
1677
- /**
1678
- * A string representation of a duration for a user session. Assumes that
1679
- * sessions may or may not be more than an hour. To prevent confusion all
1680
- * times show hours, even those that are less than an hour.
1681
- *
1682
- * @param numberOfMilliseconds - The duration in milliseconds.
1683
- * @returns The formatted duration string.
1684
- *
1685
- * @example
1686
- * sessionDurationString(2342300); // '0:39:02'
1687
- */
1688
- const sessionDurationString = (numberOfMilliseconds) => {
1689
- const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
1690
- return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
1691
- };
1692
- //#endregion
1693
- //#region src/utilities/stripExtension.ts
1694
- /**
1695
- * Removes the file extension from a string.
1696
- *
1697
- * @param str - The string to remove the file extension from.
1698
- * @returns The string without its file extension.
1699
- *
1700
- * @example
1701
- * stripExtension('config.yml'); // 'config'
1702
- * stripExtension('example.test.ts'); // 'example.test'
1703
- */
1704
- const stripExtension = (str) => (str || "").replace(/\.[^/.]{1,4}$/, "");
1705
- //#endregion
1706
- //#region src/utilities/_getLocalDateParts.ts
1707
- /**
1708
- * Get local year, month, day parts from a Date using Intl.DateTimeFormat.
1709
- * This ignores the time of day (hours, minutes, etc.).
1710
- *
1711
- * @param date - The Date to extract parts from.
1712
- * @returns The numeric year, month (1-based) and day.
1713
- */
1714
- const getLocalDateParts = (date) => {
1715
- const partsAsObject = new Intl.DateTimeFormat(defaultLocales, {
1716
- year: "numeric",
1717
- month: "numeric",
1718
- day: "numeric",
1719
- timeZone: defaultTimeZone
1720
- }).formatToParts(date).reduce((map, part) => {
1721
- map[part.type] = part.value;
1722
- return map;
1723
- }, {});
1724
- return {
1725
- year: Math.trunc(Number(partsAsObject.year)),
1726
- month: Math.trunc(Number(partsAsObject.month)),
1727
- day: Math.trunc(Number(partsAsObject.day))
1728
- };
1729
- };
1730
- //#endregion
1731
- //#region src/utilities/_differenceInCalendarDays.ts
1732
- /**
1733
- * Returns the difference in calendar days between two dates in local time,
1734
- * ignoring the time of day.
1735
- *
1736
- * @param dateLeft - The later date (or timestamp).
1737
- * @param dateRight - The earlier date (or timestamp).
1738
- * @returns The number of calendar days (can be negative).
1739
- */
1740
- const differenceInCalendarDays = (dateLeft, dateRight) => {
1741
- const leftDate = isDate(dateLeft) ? dateLeft : new Date(dateLeft);
1742
- const rightDate = isDate(dateRight) ? dateRight : new Date(dateRight);
1743
- if (Number.isNaN(leftDate.getTime()) || Number.isNaN(rightDate.getTime())) return NaN;
1744
- const { year: y1, month: m1, day: d1 } = getLocalDateParts(leftDate);
1745
- const { year: y2, month: m2, day: d2 } = getLocalDateParts(rightDate);
1746
- const msDiff = new Date(y1, m1 - 1, d1).getTime() - new Date(y2, m2 - 1, d2).getTime();
1747
- return Math.round(msDiff / millisecondsInDay);
1748
- };
1749
- //#endregion
1750
- //#region src/utilities/timeAgoString.ts
1751
- /**
1752
- * Shows time ago relative to current time, e.g. '< 1 minute ago',
1753
- * '33 minutes ago', 'Today, 3:30 PM', 'Yesterday, 6:22 AM',
1754
- * 'Nov 11, 11:32 AM', or 'Feb 23, 2020, 1:55 PM'. When includeTime is
1755
- * false: 'Today', 'Yesterday', 'on Thursday', 'Nov 11', 'Feb 23, 2020'.
1756
- *
1757
- * NOTE: timeAgoString doesn't support multiple time zones since doing so
1758
- * would complicate calculations for whether to use "Today" or "Yesterday".
1759
- *
1760
- * @param date - The date relative to now.
1761
- * @param options - Formatting options.
1762
- * @param options.nowAnchor - The date used to calculate relative to now. Defaults to the current date but can be overwritten for tests.
1763
- * @param options.includeTime - Whether to include the time in the output. Defaults to true.
1764
- * @returns The relative date string, or '' for invalid input.
1765
- *
1766
- * @example
1767
- * timeAgoString(new Date(Date.now() - 30_000)); // '< 1 minute ago'
1768
- */
1769
- const timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date(), includeTime = true } = {}) => {
1770
- if (isInvalidDate(date)) return "";
1771
- const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (60 * milisecondsInSecond);
1772
- const minutesAgoRounded = Math.round(minutesAgo);
1773
- const differenceInDays = differenceInCalendarDays(nowAnchor, date);
1774
- const isSameYear = date.getFullYear() === nowAnchor.getFullYear();
1775
- if (minutesAgo < 0) return dateTimeString(date);
1776
- if (minutesAgo < 1) return "< 1 minute ago";
1777
- if (minutesAgoRounded < 2) return "1 minute ago";
1778
- if (minutesAgoRounded <= 60) return `${minutesAgoRounded} minutes ago`;
1779
- if (differenceInDays === 0) return includeTime ? `Today, ${Intl.DateTimeFormat(defaultLocales, {
1780
- hour: "numeric",
1781
- minute: "2-digit"
1782
- }).format(date)}` : "Today";
1783
- if (differenceInDays === 1) return includeTime ? `Yesterday, ${Intl.DateTimeFormat(defaultLocales, {
1784
- hour: "numeric",
1785
- minute: "2-digit"
1786
- }).format(date)}` : "Yesterday";
1787
- if (differenceInDays < 7 && !includeTime) return `on ${dayOfWeekString(date)}`;
1788
- return includeTime ? dateTimeString(date, { omitYear: isSameYear }) : dateOnlyString(date, { omitYear: false });
1789
- };
1790
- //#endregion
1791
- //#region src/utilities/timeOnlyString.ts
1792
- /**
1793
- * Converts a Date object into a time only string, e.g. '7:30 AM'.
1794
- * Formats with the en-US locale.
1795
- *
1796
- * @param date - The Date to format; gracefully handles any value.
1797
- * @param options - Formatting options.
1798
- * @param options.timeZone - The time zone to display the time in. Defaults to the current time zone.
1799
- * @returns The formatted time string, or '' for invalid input.
1800
- *
1801
- * @example
1802
- * timeOnlyString(new Date(2011, 11, 15, 7, 30)); // '7:30 AM'
1803
- */
1804
- const timeOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
1805
- if (!isDate(date) || isInvalidDate(date)) return "";
1806
- try {
1807
- return new Intl.DateTimeFormat(defaultLocales, {
1808
- timeStyle: "short",
1809
- timeZone
1810
- }).format(date);
1811
- } catch (error) {
1812
- console.error(error);
1813
- return "";
1814
- }
1815
- };
1816
- //#endregion
1817
- //#region src/utilities/tupleIncludes.ts
1818
- /**
1819
- * Checks if a tuple includes the given item, with type narrowing.
1820
- *
1821
- * @param tuple - The tuple to search.
1822
- * @param item - The item to search for.
1823
- * @returns True if the tuple includes the item, false otherwise.
1824
- *
1825
- * @example
1826
- * const tuple = ['x', 'y'] as const;
1827
- * tupleIncludes(tuple, 'x'); // true
1828
- * tupleIncludes(tuple, 'z'); // false
1829
- */
1830
- const tupleIncludes = (tuple, item) => tuple.includes(item);
1831
- //#endregion
1832
- exports.asyncNoOpFn = asyncNoOpFn;
1833
- exports.buildTimeDuration = buildTimeDuration;
1834
- exports.coerceToBoolean = coerceToBoolean;
1835
- exports.dateOnlyISOString = dateOnlyISOString;
1836
- exports.dateOnlyString = dateOnlyString;
1837
- exports.dateOnlyStringForSentence = dateOnlyStringForSentence;
1838
- exports.dateOnlyStringNumeric = dateOnlyStringNumeric;
1839
- exports.dateTimeRounded = dateTimeRounded;
1840
- exports.dateTimeString = dateTimeString;
1841
- exports.dateTimeStringForSentence = dateTimeStringForSentence;
1842
- exports.dateTimeToDate = dateTimeToDate;
1843
- exports.dateTimeToISO = dateTimeToISO;
1844
- exports.dateToDateTime = dateToDateTime;
1845
- exports.dateUTCOffset = dateUTCOffset;
1846
- exports.dayOfWeekString = dayOfWeekString;
1847
- exports.deepMerge = deepMerge;
1848
- exports.getObjectEntries = getObjectEntries;
1849
- exports.getObjectKeys = getObjectKeys;
1850
- exports.getObjectValues = getObjectValues;
1851
- exports.hasKey = hasKey;
1852
- exports.isArray = isArray;
1853
- exports.isAsyncFunction = isAsyncFunction;
1854
- exports.isBigInt = isBigInt;
1855
- exports.isBoolean = isBoolean;
1856
- exports.isDate = isDate;
1857
- exports.isEmail = isEmail;
1858
- exports.isEmptyArray = isEmptyArray;
1859
- exports.isEmptyRecord = isEmptyRecord;
1860
- exports.isEmptyString = isEmptyString;
1861
- exports.isError = isError;
1862
- exports.isFalsy = isFalsy;
1863
- exports.isFiniteNumber = isFiniteNumber;
1864
- exports.isFunction = isFunction;
1865
- exports.isHtmlButtonElement = isHtmlButtonElement;
1866
- exports.isHtmlElement = isHtmlElement;
1867
- exports.isHtmlInputElement = isHtmlInputElement;
1868
- exports.isHtmlVideoElement = isHtmlVideoElement;
1869
- exports.isInteger = isInteger;
1870
- exports.isIterable = isIterable;
1871
- exports.isMap = isMap;
1872
- exports.isMouseEvent = isMouseEvent;
1873
- exports.isNaN = isNaN;
1874
- exports.isNil = isNil;
1875
- exports.isNonBlankString = isNonBlankString;
1876
- exports.isNonEmptyArray = isNonEmptyArray;
1877
- exports.isNonEmptyRecord = isNonEmptyRecord;
1878
- exports.isNonEmptyString = isNonEmptyString;
1879
- exports.isNonNaNNumber = isNonNaNNumber;
1880
- exports.isNotArray = isNotArray;
1881
- exports.isNotBoolean = isNotBoolean;
1882
- exports.isNotFunction = isNotFunction;
1883
- exports.isNotNil = isNotNil;
1884
- exports.isNotNull = isNotNull;
1885
- exports.isNotNumber = isNotNumber;
1886
- exports.isNotRecord = isNotRecord;
1887
- exports.isNotString = isNotString;
1888
- exports.isNotUndefined = isNotUndefined;
1889
- exports.isNotVoid = isNotVoid;
1890
- exports.isNull = isNull;
1891
- exports.isNumber = isNumber;
1892
- exports.isPlainObject = isPlainObject;
1893
- exports.isPromise = isPromise;
1894
- exports.isRecord = isRecord;
1895
- exports.isRegExp = isRegExp;
1896
- exports.isSet = isSet;
1897
- exports.isString = isString;
1898
- exports.isSvgElement = isSvgElement;
1899
- exports.isSymbol = isSymbol;
1900
- exports.isTextNode = isTextNode;
1901
- exports.isTruthy = isTruthy;
1902
- exports.isUndefined = isUndefined;
1903
- exports.isUrl = isUrl;
1904
- exports.isVoid = isVoid;
1905
- exports.isWeakMap = isWeakMap;
1906
- exports.isWeakSet = isWeakSet;
1907
- exports.mediaDurationString = mediaDurationString;
1908
- exports.millisecondsToDurationISOString = millisecondsToDurationISOString;
1909
- exports.monthDayStringNumeric = monthDayStringNumeric;
1910
- exports.noOpFn = noOpFn;
1911
- exports.noOpFnReturningFalse = noOpFnReturningFalse;
1912
- exports.noOpFnReturningNull = noOpFnReturningNull;
1913
- exports.parseDateString = parseDateString;
1914
- exports.readonlyArrayIncludes = readonlyArrayIncludes;
1915
- exports.sessionDurationString = sessionDurationString;
1916
- exports.stripExtension = stripExtension;
1917
- exports.timeAgoString = timeAgoString;
1918
- exports.timeOnlyString = timeOnlyString;
1919
- exports.tupleIncludes = tupleIncludes;
1920
-
1921
- //# sourceMappingURL=index.cjs.map