@xylabs/typeof 5.0.83 → 5.0.84

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/README.md CHANGED
@@ -94,6 +94,8 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
94
94
  function ifDefined<T>(value, func): T | undefined;
95
95
  ```
96
96
 
97
+ Invokes the callback only if the value is neither null nor undefined.
98
+
97
99
  ## Type Parameters
98
100
 
99
101
  ### T
@@ -106,14 +108,20 @@ function ifDefined<T>(value, func): T | undefined;
106
108
 
107
109
  `T`
108
110
 
111
+ The value to check.
112
+
109
113
  ### func
110
114
 
111
115
  (`value`) => `void`
112
116
 
117
+ The callback to invoke with the value if it is defined.
118
+
113
119
  ## Returns
114
120
 
115
121
  `T` \| `undefined`
116
122
 
123
+ The value if defined, or undefined otherwise.
124
+
117
125
  ### <a id="ifTypeOf"></a>ifTypeOf
118
126
 
119
127
  [**@xylabs/typeof**](#../README)
@@ -128,6 +136,8 @@ function ifTypeOf<T, R>(
128
136
  isFunc?): R | undefined;
129
137
  ```
130
138
 
139
+ Invokes the callback if the value matches the specified type, with an optional additional predicate.
140
+
131
141
  ## Type Parameters
132
142
 
133
143
  ### T
@@ -144,22 +154,32 @@ function ifTypeOf<T, R>(
144
154
 
145
155
  [`TypeOfTypes`](#../type-aliases/TypeOfTypes)
146
156
 
157
+ The expected type name to match against.
158
+
147
159
  ### value
148
160
 
149
161
  `unknown`
150
162
 
163
+ The value to check.
164
+
151
165
  ### trueFunc
152
166
 
153
167
  (`value`) => `R`
154
168
 
169
+ The callback to invoke if the type matches.
170
+
155
171
  ### isFunc?
156
172
 
157
173
  (`value`) => `boolean`
158
174
 
175
+ Optional additional predicate that must also return true.
176
+
159
177
  ## Returns
160
178
 
161
179
  `R` \| `undefined`
162
180
 
181
+ The result of trueFunc if the type matches (and isFunc passes), or undefined.
182
+
163
183
  ### <a id="isArray"></a>isArray
164
184
 
165
185
  [**@xylabs/typeof**](#../README)
@@ -172,6 +192,8 @@ function ifTypeOf<T, R>(
172
192
  function isArray(value): value is readonly unknown[];
173
193
  ```
174
194
 
195
+ Type guard that checks whether a value is an array.
196
+
175
197
  ### Parameters
176
198
 
177
199
  ### value
@@ -188,6 +210,8 @@ function isArray(value): value is readonly unknown[];
188
210
  function isArray<T>(value): value is Extract<T, readonly unknown[]>;
189
211
  ```
190
212
 
213
+ Type guard that checks whether a value is an array.
214
+
191
215
  ### Type Parameters
192
216
 
193
217
  ### T
@@ -216,6 +240,8 @@ function isArray<T>(value): value is Extract<T, readonly unknown[]>;
216
240
  function isArrayBufferView(value): value is ArrayBufferView<ArrayBufferLike>;
217
241
  ```
218
242
 
243
+ Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray or DataView).
244
+
219
245
  ### Parameters
220
246
 
221
247
  ### value
@@ -232,6 +258,8 @@ function isArrayBufferView(value): value is ArrayBufferView<ArrayBufferLike>;
232
258
  function isArrayBufferView<T>(value): value is Extract<T, ArrayBufferView<ArrayBufferLike>>;
233
259
  ```
234
260
 
261
+ Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray or DataView).
262
+
235
263
  ### Type Parameters
236
264
 
237
265
  ### T
@@ -260,6 +288,8 @@ function isArrayBufferView<T>(value): value is Extract<T, ArrayBufferView<ArrayB
260
288
  function isBigInt(value): value is bigint;
261
289
  ```
262
290
 
291
+ Type guard that checks whether a value is a bigint.
292
+
263
293
  ### Parameters
264
294
 
265
295
  ### value
@@ -276,6 +306,8 @@ function isBigInt(value): value is bigint;
276
306
  function isBigInt<T>(value): value is Extract<T, bigint>;
277
307
  ```
278
308
 
309
+ Type guard that checks whether a value is a bigint.
310
+
279
311
  ### Type Parameters
280
312
 
281
313
  ### T
@@ -304,6 +336,8 @@ function isBigInt<T>(value): value is Extract<T, bigint>;
304
336
  function isBlob(value): value is Blob;
305
337
  ```
306
338
 
339
+ Type guard that checks whether a value is a Blob instance.
340
+
307
341
  ### Parameters
308
342
 
309
343
  ### value
@@ -320,6 +354,8 @@ function isBlob(value): value is Blob;
320
354
  function isBlob<T>(value): value is Extract<T, Blob>;
321
355
  ```
322
356
 
357
+ Type guard that checks whether a value is a Blob instance.
358
+
323
359
  ### Type Parameters
324
360
 
325
361
  ### T
@@ -348,6 +384,8 @@ function isBlob<T>(value): value is Extract<T, Blob>;
348
384
  function isBoolean(value): value is boolean;
349
385
  ```
350
386
 
387
+ Type guard that checks whether a value is a boolean.
388
+
351
389
  ### Parameters
352
390
 
353
391
  ### value
@@ -364,6 +402,8 @@ function isBoolean(value): value is boolean;
364
402
  function isBoolean<T>(value): value is Extract<T, boolean>;
365
403
  ```
366
404
 
405
+ Type guard that checks whether a value is a boolean.
406
+
367
407
  ### Type Parameters
368
408
 
369
409
  ### T
@@ -392,6 +432,8 @@ function isBoolean<T>(value): value is Extract<T, boolean>;
392
432
  function isDataView(value): value is DataView<ArrayBufferLike>;
393
433
  ```
394
434
 
435
+ Type guard that checks whether a value is a DataView instance.
436
+
395
437
  ### Parameters
396
438
 
397
439
  ### value
@@ -408,6 +450,8 @@ function isDataView(value): value is DataView<ArrayBufferLike>;
408
450
  function isDataView<T>(value): value is Extract<T, DataView<ArrayBufferLike>>;
409
451
  ```
410
452
 
453
+ Type guard that checks whether a value is a DataView instance.
454
+
411
455
  ### Type Parameters
412
456
 
413
457
  ### T
@@ -436,6 +480,8 @@ function isDataView<T>(value): value is Extract<T, DataView<ArrayBufferLike>>;
436
480
  function isDate(value): value is Date;
437
481
  ```
438
482
 
483
+ Type guard that checks whether a value is a Date instance.
484
+
439
485
  ### Parameters
440
486
 
441
487
  ### value
@@ -452,6 +498,8 @@ function isDate(value): value is Date;
452
498
  function isDate<T>(value): value is Extract<T, Date>;
453
499
  ```
454
500
 
501
+ Type guard that checks whether a value is a Date instance.
502
+
455
503
  ### Type Parameters
456
504
 
457
505
  ### T
@@ -480,6 +528,8 @@ function isDate<T>(value): value is Extract<T, Date>;
480
528
  function isDateString(value): value is string;
481
529
  ```
482
530
 
531
+ Type guard that checks whether a value is a string that can be parsed as a valid date.
532
+
483
533
  ### Parameters
484
534
 
485
535
  ### value
@@ -496,6 +546,8 @@ function isDateString(value): value is string;
496
546
  function isDateString<T>(value): value is Extract<T, string>;
497
547
  ```
498
548
 
549
+ Type guard that checks whether a value is a string that can be parsed as a valid date.
550
+
499
551
  ### Type Parameters
500
552
 
501
553
  ### T
@@ -522,6 +574,8 @@ function isDateString<T>(value): value is Extract<T, string>;
522
574
  function isDefined<T>(value): value is Exclude<T, undefined>;
523
575
  ```
524
576
 
577
+ Type guard that checks whether a value is not undefined.
578
+
525
579
  ## Type Parameters
526
580
 
527
581
  ### T
@@ -548,6 +602,8 @@ function isDefined<T>(value): value is Exclude<T, undefined>;
548
602
  function isDefinedNotNull<T>(value): value is Exclude<T, null | undefined>;
549
603
  ```
550
604
 
605
+ Type guard that checks whether a value is neither undefined nor null.
606
+
551
607
  ## Type Parameters
552
608
 
553
609
  ### T
@@ -576,6 +632,8 @@ value is Exclude\<T, null \| undefined\>
576
632
  function isEmpty<T>(value): value is T;
577
633
  ```
578
634
 
635
+ Type guard that checks whether a value is empty (empty string, empty array, or empty object).
636
+
579
637
  ### Type Parameters
580
638
 
581
639
  ### T
@@ -598,6 +656,8 @@ function isEmpty<T>(value): value is T;
598
656
  function isEmpty<K, V, T>(value): value is Extract<T, Record<K, never>>;
599
657
  ```
600
658
 
659
+ Type guard that checks whether a value is empty (empty string, empty array, or empty object).
660
+
601
661
  ### Type Parameters
602
662
 
603
663
  ### K
@@ -628,6 +688,8 @@ function isEmpty<K, V, T>(value): value is Extract<T, Record<K, never>>;
628
688
  function isEmpty<T>(value): value is Extract<T, never[]>;
629
689
  ```
630
690
 
691
+ Type guard that checks whether a value is empty (empty string, empty array, or empty object).
692
+
631
693
  ### Type Parameters
632
694
 
633
695
  ### T
@@ -656,6 +718,8 @@ function isEmpty<T>(value): value is Extract<T, never[]>;
656
718
  function isEmptyArray(value): value is [];
657
719
  ```
658
720
 
721
+ Type guard that checks whether a value is an empty array.
722
+
659
723
  ### Parameters
660
724
 
661
725
  ### value
@@ -672,6 +736,8 @@ function isEmptyArray(value): value is [];
672
736
  function isEmptyArray<T>(value): value is Extract<T, unknown[]>;
673
737
  ```
674
738
 
739
+ Type guard that checks whether a value is an empty array.
740
+
675
741
  ### Type Parameters
676
742
 
677
743
  ### T
@@ -700,6 +766,8 @@ function isEmptyArray<T>(value): value is Extract<T, unknown[]>;
700
766
  function isEmptyObject(value): value is {};
701
767
  ```
702
768
 
769
+ Type guard that checks whether a value is an object with no own keys.
770
+
703
771
  ### Parameters
704
772
 
705
773
  ### value
@@ -716,6 +784,8 @@ function isEmptyObject(value): value is {};
716
784
  function isEmptyObject<K, V, T>(value): value is Extract<T, Record<K, never>>;
717
785
  ```
718
786
 
787
+ Type guard that checks whether a value is an object with no own keys.
788
+
719
789
  ### Type Parameters
720
790
 
721
791
  ### K
@@ -752,6 +822,8 @@ function isEmptyObject<K, V, T>(value): value is Extract<T, Record<K, never>>;
752
822
  function isEmptyString(value): value is "";
753
823
  ```
754
824
 
825
+ Type guard that checks whether a value is an empty string.
826
+
755
827
  ### Parameters
756
828
 
757
829
  ### value
@@ -768,6 +840,8 @@ function isEmptyString(value): value is "";
768
840
  function isEmptyString<T>(value): value is Extract<T, "">;
769
841
  ```
770
842
 
843
+ Type guard that checks whether a value is an empty string.
844
+
771
845
  ### Type Parameters
772
846
 
773
847
  ### T
@@ -796,6 +870,8 @@ function isEmptyString<T>(value): value is Extract<T, "">;
796
870
  function isError(value): value is Error;
797
871
  ```
798
872
 
873
+ Type guard that checks whether a value is an Error instance.
874
+
799
875
  ### Parameters
800
876
 
801
877
  ### value
@@ -812,6 +888,8 @@ function isError(value): value is Error;
812
888
  function isError<T>(value): value is Extract<T, Error>;
813
889
  ```
814
890
 
891
+ Type guard that checks whether a value is an Error instance.
892
+
815
893
  ### Type Parameters
816
894
 
817
895
  ### T
@@ -840,6 +918,8 @@ function isError<T>(value): value is Extract<T, Error>;
840
918
  function isFalsy<T>(value): value is Extract<T, false | "" | 0 | 0n | null | undefined>;
841
919
  ```
842
920
 
921
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
922
+
843
923
  ### Type Parameters
844
924
 
845
925
  ### T
@@ -862,6 +942,8 @@ value is Extract\<T, false \| "" \| 0 \| 0n \| null \| undefined\>
862
942
  function isFalsy<T>(value): value is Extract<T, false>;
863
943
  ```
864
944
 
945
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
946
+
865
947
  ### Type Parameters
866
948
 
867
949
  ### T
@@ -884,6 +966,8 @@ function isFalsy<T>(value): value is Extract<T, false>;
884
966
  function isFalsy<T>(value): value is Extract<T, 0>;
885
967
  ```
886
968
 
969
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
970
+
887
971
  ### Type Parameters
888
972
 
889
973
  ### T
@@ -906,6 +990,8 @@ function isFalsy<T>(value): value is Extract<T, 0>;
906
990
  function isFalsy<T>(value): value is Extract<T, 0n>;
907
991
  ```
908
992
 
993
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
994
+
909
995
  ### Type Parameters
910
996
 
911
997
  ### T
@@ -928,6 +1014,8 @@ function isFalsy<T>(value): value is Extract<T, 0n>;
928
1014
  function isFalsy<T>(value): value is Extract<T, null>;
929
1015
  ```
930
1016
 
1017
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
1018
+
931
1019
  ### Type Parameters
932
1020
 
933
1021
  ### T
@@ -950,6 +1038,8 @@ function isFalsy<T>(value): value is Extract<T, null>;
950
1038
  function isFalsy<T>(value): value is Extract<T, undefined>;
951
1039
  ```
952
1040
 
1041
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
1042
+
953
1043
  ### Type Parameters
954
1044
 
955
1045
  ### T
@@ -972,6 +1062,8 @@ function isFalsy<T>(value): value is Extract<T, undefined>;
972
1062
  function isFalsy<T>(value): value is Extract<T, "">;
973
1063
  ```
974
1064
 
1065
+ Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
1066
+
975
1067
  ### Type Parameters
976
1068
 
977
1069
  ### T
@@ -1000,6 +1092,8 @@ function isFalsy<T>(value): value is Extract<T, "">;
1000
1092
  function isFile(value): value is File;
1001
1093
  ```
1002
1094
 
1095
+ Type guard that checks whether a value is a File instance.
1096
+
1003
1097
  ### Parameters
1004
1098
 
1005
1099
  ### value
@@ -1016,6 +1110,8 @@ function isFile(value): value is File;
1016
1110
  function isFile<T>(value): value is Extract<T, File>;
1017
1111
  ```
1018
1112
 
1113
+ Type guard that checks whether a value is a File instance.
1114
+
1019
1115
  ### Type Parameters
1020
1116
 
1021
1117
  ### T
@@ -1044,6 +1140,8 @@ function isFile<T>(value): value is Extract<T, File>;
1044
1140
  function isFunction(value): value is AnyFunction;
1045
1141
  ```
1046
1142
 
1143
+ Type guard that checks whether a value is a function.
1144
+
1047
1145
  ### Parameters
1048
1146
 
1049
1147
  ### value
@@ -1060,6 +1158,8 @@ function isFunction(value): value is AnyFunction;
1060
1158
  function isFunction<T>(value): value is Extract<T, AnyFunction>;
1061
1159
  ```
1062
1160
 
1161
+ Type guard that checks whether a value is a function.
1162
+
1063
1163
  ### Type Parameters
1064
1164
 
1065
1165
  ### T
@@ -1088,6 +1188,8 @@ function isFunction<T>(value): value is Extract<T, AnyFunction>;
1088
1188
  function isMap(value): value is Map<unknown, unknown>;
1089
1189
  ```
1090
1190
 
1191
+ Type guard that checks whether a value is a Map instance.
1192
+
1091
1193
  ### Parameters
1092
1194
 
1093
1195
  ### value
@@ -1104,6 +1206,8 @@ function isMap(value): value is Map<unknown, unknown>;
1104
1206
  function isMap<K, V, T>(value): value is Extract<T, Map<K, V>>;
1105
1207
  ```
1106
1208
 
1209
+ Type guard that checks whether a value is a Map instance.
1210
+
1107
1211
  ### Type Parameters
1108
1212
 
1109
1213
  ### K
@@ -1140,6 +1244,8 @@ function isMap<K, V, T>(value): value is Extract<T, Map<K, V>>;
1140
1244
  function isNull(value): value is null;
1141
1245
  ```
1142
1246
 
1247
+ Type guard that checks whether a value is null.
1248
+
1143
1249
  ### Parameters
1144
1250
 
1145
1251
  ### value
@@ -1156,6 +1262,8 @@ function isNull(value): value is null;
1156
1262
  function isNull<T>(value): value is Extract<T, null>;
1157
1263
  ```
1158
1264
 
1265
+ Type guard that checks whether a value is null.
1266
+
1159
1267
  ### Type Parameters
1160
1268
 
1161
1269
  ### T
@@ -1184,6 +1292,8 @@ function isNull<T>(value): value is Extract<T, null>;
1184
1292
  function isNumber(value): value is number;
1185
1293
  ```
1186
1294
 
1295
+ Type guard that checks whether a value is a number.
1296
+
1187
1297
  ### Parameters
1188
1298
 
1189
1299
  ### value
@@ -1200,6 +1310,8 @@ function isNumber(value): value is number;
1200
1310
  function isNumber<T>(value): value is Extract<T, number>;
1201
1311
  ```
1202
1312
 
1313
+ Type guard that checks whether a value is a number.
1314
+
1203
1315
  ### Type Parameters
1204
1316
 
1205
1317
  ### T
@@ -1228,6 +1340,8 @@ function isNumber<T>(value): value is Extract<T, number>;
1228
1340
  function isObject(value): value is object;
1229
1341
  ```
1230
1342
 
1343
+ Type guard that checks whether a value is a plain object (not null and not an array).
1344
+
1231
1345
  ### Parameters
1232
1346
 
1233
1347
  ### value
@@ -1244,6 +1358,8 @@ function isObject(value): value is object;
1244
1358
  function isObject<T>(value): value is Extract<T, object>;
1245
1359
  ```
1246
1360
 
1361
+ Type guard that checks whether a value is a plain object (not null and not an array).
1362
+
1247
1363
  ### Type Parameters
1248
1364
 
1249
1365
  ### T
@@ -1272,6 +1388,8 @@ function isObject<T>(value): value is Extract<T, object>;
1272
1388
  function isPopulatedArray(value): value is readonly unknown[];
1273
1389
  ```
1274
1390
 
1391
+ Type guard that checks whether a value is a non-empty array.
1392
+
1275
1393
  ### Parameters
1276
1394
 
1277
1395
  ### value
@@ -1288,6 +1406,8 @@ function isPopulatedArray(value): value is readonly unknown[];
1288
1406
  function isPopulatedArray<T>(value): value is Extract<T, readonly unknown[]>;
1289
1407
  ```
1290
1408
 
1409
+ Type guard that checks whether a value is a non-empty array.
1410
+
1291
1411
  ### Type Parameters
1292
1412
 
1293
1413
  ### T
@@ -1316,6 +1436,8 @@ function isPopulatedArray<T>(value): value is Extract<T, readonly unknown[]>;
1316
1436
  function isPromise(value): value is Promise<unknown>;
1317
1437
  ```
1318
1438
 
1439
+ Type guard that checks whether a value is a Promise instance.
1440
+
1319
1441
  ### Parameters
1320
1442
 
1321
1443
  ### value
@@ -1332,6 +1454,8 @@ function isPromise(value): value is Promise<unknown>;
1332
1454
  function isPromise<T>(value): value is Extract<T, Promise<unknown>>;
1333
1455
  ```
1334
1456
 
1457
+ Type guard that checks whether a value is a Promise instance.
1458
+
1335
1459
  ### Type Parameters
1336
1460
 
1337
1461
  ### T
@@ -1360,6 +1484,8 @@ function isPromise<T>(value): value is Extract<T, Promise<unknown>>;
1360
1484
  function isPromiseLike(value): value is Promise<unknown>;
1361
1485
  ```
1362
1486
 
1487
+ Type guard that checks whether a value is promise-like (has a `then` method).
1488
+
1363
1489
  ### Parameters
1364
1490
 
1365
1491
  ### value
@@ -1376,6 +1502,8 @@ function isPromiseLike(value): value is Promise<unknown>;
1376
1502
  function isPromiseLike<T>(value): value is Extract<T, Promise<unknown>>;
1377
1503
  ```
1378
1504
 
1505
+ Type guard that checks whether a value is promise-like (has a `then` method).
1506
+
1379
1507
  ### Type Parameters
1380
1508
 
1381
1509
  ### T
@@ -1404,6 +1532,8 @@ function isPromiseLike<T>(value): value is Extract<T, Promise<unknown>>;
1404
1532
  function isRegExp(value): value is RegExp;
1405
1533
  ```
1406
1534
 
1535
+ Type guard that checks whether a value is a RegExp instance.
1536
+
1407
1537
  ### Parameters
1408
1538
 
1409
1539
  ### value
@@ -1420,6 +1550,8 @@ function isRegExp(value): value is RegExp;
1420
1550
  function isRegExp<T>(value): value is Extract<T, RegExp>;
1421
1551
  ```
1422
1552
 
1553
+ Type guard that checks whether a value is a RegExp instance.
1554
+
1423
1555
  ### Type Parameters
1424
1556
 
1425
1557
  ### T
@@ -1448,6 +1580,8 @@ function isRegExp<T>(value): value is Extract<T, RegExp>;
1448
1580
  function isSet(value): value is Set<unknown>;
1449
1581
  ```
1450
1582
 
1583
+ Type guard that checks whether a value is a Set instance.
1584
+
1451
1585
  ### Parameters
1452
1586
 
1453
1587
  ### value
@@ -1464,6 +1598,8 @@ function isSet(value): value is Set<unknown>;
1464
1598
  function isSet<T>(value): value is Extract<T, Set<unknown>>;
1465
1599
  ```
1466
1600
 
1601
+ Type guard that checks whether a value is a Set instance.
1602
+
1467
1603
  ### Type Parameters
1468
1604
 
1469
1605
  ### T
@@ -1492,6 +1628,8 @@ function isSet<T>(value): value is Extract<T, Set<unknown>>;
1492
1628
  function isString(value): value is string;
1493
1629
  ```
1494
1630
 
1631
+ Type guard that checks whether a value is a string.
1632
+
1495
1633
  ### Parameters
1496
1634
 
1497
1635
  ### value
@@ -1508,6 +1646,8 @@ function isString(value): value is string;
1508
1646
  function isString<T>(value): value is Extract<T, string>;
1509
1647
  ```
1510
1648
 
1649
+ Type guard that checks whether a value is a string.
1650
+
1511
1651
  ### Type Parameters
1512
1652
 
1513
1653
  ### T
@@ -1536,6 +1676,8 @@ function isString<T>(value): value is Extract<T, string>;
1536
1676
  function isSymbol(value): value is symbol;
1537
1677
  ```
1538
1678
 
1679
+ Type guard that checks whether a value is a symbol.
1680
+
1539
1681
  ### Parameters
1540
1682
 
1541
1683
  ### value
@@ -1552,6 +1694,8 @@ function isSymbol(value): value is symbol;
1552
1694
  function isSymbol<T>(value): value is Extract<T, symbol>;
1553
1695
  ```
1554
1696
 
1697
+ Type guard that checks whether a value is a symbol.
1698
+
1555
1699
  ### Type Parameters
1556
1700
 
1557
1701
  ### T
@@ -1580,6 +1724,8 @@ function isSymbol<T>(value): value is Extract<T, symbol>;
1580
1724
  function isTruthy<T>(value): value is Exclude<T, false | "" | 0 | 0n | null | undefined>;
1581
1725
  ```
1582
1726
 
1727
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1728
+
1583
1729
  ### Type Parameters
1584
1730
 
1585
1731
  ### T
@@ -1602,6 +1748,8 @@ value is Exclude\<T, false \| "" \| 0 \| 0n \| null \| undefined\>
1602
1748
  function isTruthy<T>(value): value is Extract<T, true>;
1603
1749
  ```
1604
1750
 
1751
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1752
+
1605
1753
  ### Type Parameters
1606
1754
 
1607
1755
  ### T
@@ -1624,6 +1772,8 @@ function isTruthy<T>(value): value is Extract<T, true>;
1624
1772
  function isTruthy<T>(value): value is Extract<T, number>;
1625
1773
  ```
1626
1774
 
1775
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1776
+
1627
1777
  ### Type Parameters
1628
1778
 
1629
1779
  ### T
@@ -1646,6 +1796,8 @@ function isTruthy<T>(value): value is Extract<T, number>;
1646
1796
  function isTruthy<T>(value): value is Extract<T, bigint>;
1647
1797
  ```
1648
1798
 
1799
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1800
+
1649
1801
  ### Type Parameters
1650
1802
 
1651
1803
  ### T
@@ -1668,6 +1820,8 @@ function isTruthy<T>(value): value is Extract<T, bigint>;
1668
1820
  function isTruthy<T>(value): value is Extract<T, null>;
1669
1821
  ```
1670
1822
 
1823
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1824
+
1671
1825
  ### Type Parameters
1672
1826
 
1673
1827
  ### T
@@ -1690,6 +1844,8 @@ function isTruthy<T>(value): value is Extract<T, null>;
1690
1844
  function isTruthy<T>(value): value is Extract<T, undefined>;
1691
1845
  ```
1692
1846
 
1847
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1848
+
1693
1849
  ### Type Parameters
1694
1850
 
1695
1851
  ### T
@@ -1712,6 +1868,8 @@ function isTruthy<T>(value): value is Extract<T, undefined>;
1712
1868
  function isTruthy<T>(value): value is Extract<T, string>;
1713
1869
  ```
1714
1870
 
1871
+ Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
1872
+
1715
1873
  ### Type Parameters
1716
1874
 
1717
1875
  ### T
@@ -1738,20 +1896,28 @@ function isTruthy<T>(value): value is Extract<T, string>;
1738
1896
  function isType(value, expectedType): boolean;
1739
1897
  ```
1740
1898
 
1899
+ Checks whether a value matches the expected field type, with correct handling for arrays and nulls.
1900
+
1741
1901
  ## Parameters
1742
1902
 
1743
1903
  ### value
1744
1904
 
1745
1905
  `unknown`
1746
1906
 
1907
+ The value to check.
1908
+
1747
1909
  ### expectedType
1748
1910
 
1749
1911
  [`FieldType`](#../type-aliases/FieldType)
1750
1912
 
1913
+ The expected type string.
1914
+
1751
1915
  ## Returns
1752
1916
 
1753
1917
  `boolean`
1754
1918
 
1919
+ True if the value matches the expected type.
1920
+
1755
1921
  ### <a id="isTypedArray"></a>isTypedArray
1756
1922
 
1757
1923
  [**@xylabs/typeof**](#../README)
@@ -1762,16 +1928,22 @@ function isType(value, expectedType): boolean;
1762
1928
  function isTypedArray(value): value is TypedArray;
1763
1929
  ```
1764
1930
 
1931
+ Type guard that checks whether a value is a TypedArray (an array where every element is a TypedValue).
1932
+
1765
1933
  ## Parameters
1766
1934
 
1767
1935
  ### value
1768
1936
 
1769
1937
  `unknown`
1770
1938
 
1939
+ The value to check.
1940
+
1771
1941
  ## Returns
1772
1942
 
1773
1943
  `value is TypedArray`
1774
1944
 
1945
+ True if the value is an array of TypedValue elements.
1946
+
1775
1947
  ### <a id="isTypedKey"></a>isTypedKey
1776
1948
 
1777
1949
  [**@xylabs/typeof**](#../README)
@@ -1782,16 +1954,22 @@ function isTypedArray(value): value is TypedArray;
1782
1954
  function isTypedKey(value): value is string | number | symbol;
1783
1955
  ```
1784
1956
 
1957
+ Type guard that checks whether a value is a valid TypedKey (string, bigint, number, or symbol).
1958
+
1785
1959
  ## Parameters
1786
1960
 
1787
1961
  ### value
1788
1962
 
1789
1963
  `unknown`
1790
1964
 
1965
+ The value to check.
1966
+
1791
1967
  ## Returns
1792
1968
 
1793
1969
  value is string \| number \| symbol
1794
1970
 
1971
+ True if the value is a valid TypedKey.
1972
+
1795
1973
  ### <a id="isTypedObject"></a>isTypedObject
1796
1974
 
1797
1975
  [**@xylabs/typeof**](#../README)
@@ -1802,16 +1980,22 @@ value is string \| number \| symbol
1802
1980
  function isTypedObject(value): value is TypedObject;
1803
1981
  ```
1804
1982
 
1983
+ Type guard that checks whether a value is a TypedObject (an object with TypedKey keys and TypedValue values).
1984
+
1805
1985
  ## Parameters
1806
1986
 
1807
1987
  ### value
1808
1988
 
1809
1989
  `unknown`
1810
1990
 
1991
+ The value to check.
1992
+
1811
1993
  ## Returns
1812
1994
 
1813
1995
  `value is TypedObject`
1814
1996
 
1997
+ True if the value is a valid TypedObject.
1998
+
1815
1999
  ### <a id="isTypedValue"></a>isTypedValue
1816
2000
 
1817
2001
  [**@xylabs/typeof**](#../README)
@@ -1822,16 +2006,22 @@ function isTypedObject(value): value is TypedObject;
1822
2006
  function isTypedValue(value): value is TypedValue;
1823
2007
  ```
1824
2008
 
2009
+ Type guard that checks whether a value is a valid TypedValue.
2010
+
1825
2011
  ## Parameters
1826
2012
 
1827
2013
  ### value
1828
2014
 
1829
2015
  `unknown`
1830
2016
 
2017
+ The value to check.
2018
+
1831
2019
  ## Returns
1832
2020
 
1833
2021
  `value is TypedValue`
1834
2022
 
2023
+ True if the value is a string, number, boolean, null, TypedObject, or TypedArray.
2024
+
1835
2025
  ### <a id="isUndefined"></a>isUndefined
1836
2026
 
1837
2027
  [**@xylabs/typeof**](#../README)
@@ -1844,6 +2034,8 @@ function isTypedValue(value): value is TypedValue;
1844
2034
  function isUndefined(value): value is undefined;
1845
2035
  ```
1846
2036
 
2037
+ Type guard that checks whether a value is undefined.
2038
+
1847
2039
  ### Parameters
1848
2040
 
1849
2041
  ### value
@@ -1860,6 +2052,8 @@ function isUndefined(value): value is undefined;
1860
2052
  function isUndefined<T>(value): value is Extract<T, undefined>;
1861
2053
  ```
1862
2054
 
2055
+ Type guard that checks whether a value is undefined.
2056
+
1863
2057
  ### Type Parameters
1864
2058
 
1865
2059
  ### T
@@ -1888,6 +2082,8 @@ function isUndefined<T>(value): value is Extract<T, undefined>;
1888
2082
  function isUndefinedOrNull(value): value is null | undefined;
1889
2083
  ```
1890
2084
 
2085
+ Type guard that checks whether a value is undefined or null.
2086
+
1891
2087
  ### Parameters
1892
2088
 
1893
2089
  ### value
@@ -1904,6 +2100,8 @@ value is null \| undefined
1904
2100
  function isUndefinedOrNull<T>(value): value is Extract<T, null | undefined>;
1905
2101
  ```
1906
2102
 
2103
+ Type guard that checks whether a value is undefined or null.
2104
+
1907
2105
  ### Type Parameters
1908
2106
 
1909
2107
  ### T
@@ -1930,16 +2128,22 @@ value is Extract\<T, null \| undefined\>
1930
2128
  function isValidTypedFieldPair(pair): pair is [key: string | number | symbol, value: TypedValue];
1931
2129
  ```
1932
2130
 
2131
+ Type guard that checks whether a key-value pair has a valid TypedKey and TypedValue.
2132
+
1933
2133
  ## Parameters
1934
2134
 
1935
2135
  ### pair
1936
2136
 
1937
2137
  \[`unknown`, `unknown`\]
1938
2138
 
2139
+ A tuple of [key, value] to validate.
2140
+
1939
2141
  ## Returns
1940
2142
 
1941
2143
  pair is \[key: string \| number \| symbol, value: TypedValue\]
1942
2144
 
2145
+ True if the key is a TypedKey and the value is a TypedValue.
2146
+
1943
2147
  ### <a id="isWeakMap"></a>isWeakMap
1944
2148
 
1945
2149
  [**@xylabs/typeof**](#../README)
@@ -1952,6 +2156,8 @@ pair is \[key: string \| number \| symbol, value: TypedValue\]
1952
2156
  function isWeakMap(value): value is WeakMap<WeakKey, unknown>;
1953
2157
  ```
1954
2158
 
2159
+ Type guard that checks whether a value is a WeakMap instance.
2160
+
1955
2161
  ### Parameters
1956
2162
 
1957
2163
  ### value
@@ -1968,6 +2174,8 @@ function isWeakMap(value): value is WeakMap<WeakKey, unknown>;
1968
2174
  function isWeakMap<K, V, T>(value): value is Extract<T, WeakMap<K, V>>;
1969
2175
  ```
1970
2176
 
2177
+ Type guard that checks whether a value is a WeakMap instance.
2178
+
1971
2179
  ### Type Parameters
1972
2180
 
1973
2181
  ### K
@@ -2004,6 +2212,8 @@ function isWeakMap<K, V, T>(value): value is Extract<T, WeakMap<K, V>>;
2004
2212
  function isWeakSet(value): value is WeakSet<WeakKey>;
2005
2213
  ```
2006
2214
 
2215
+ Type guard that checks whether a value is a WeakSet instance.
2216
+
2007
2217
  ### Parameters
2008
2218
 
2009
2219
  ### value
@@ -2020,6 +2230,8 @@ function isWeakSet(value): value is WeakSet<WeakKey>;
2020
2230
  function isWeakSet<K, T>(value): value is Extract<T, WeakSet<K>>;
2021
2231
  ```
2022
2232
 
2233
+ Type guard that checks whether a value is a WeakSet instance.
2234
+
2023
2235
  ### Type Parameters
2024
2236
 
2025
2237
  ### K
@@ -2050,6 +2262,8 @@ function isWeakSet<K, T>(value): value is Extract<T, WeakSet<K>>;
2050
2262
  function typeOf<T>(item): TypeOfTypes;
2051
2263
  ```
2052
2264
 
2265
+ Extended typeof that distinguishes arrays from objects (unlike native `typeof`).
2266
+
2053
2267
  ## Type Parameters
2054
2268
 
2055
2269
  ### T
@@ -2062,10 +2276,14 @@ function typeOf<T>(item): TypeOfTypes;
2062
2276
 
2063
2277
  `T`
2064
2278
 
2279
+ The value to check.
2280
+
2065
2281
  ## Returns
2066
2282
 
2067
2283
  [`TypeOfTypes`](#../type-aliases/TypeOfTypes)
2068
2284
 
2285
+ The type of the item as a TypeOfTypes string.
2286
+
2069
2287
  ### <a id="validateType"></a>validateType
2070
2288
 
2071
2289
  [**@xylabs/typeof**](#../README)
@@ -2079,6 +2297,8 @@ function validateType<T>(
2079
2297
  optional?): [T | undefined, Error[]];
2080
2298
  ```
2081
2299
 
2300
+ Validates that a value matches the expected type, returning the value and any errors.
2301
+
2082
2302
  ## Type Parameters
2083
2303
 
2084
2304
  ### T
@@ -2091,18 +2311,26 @@ function validateType<T>(
2091
2311
 
2092
2312
  [`TypeOfTypes`](#../type-aliases/TypeOfTypes)
2093
2313
 
2314
+ The expected type name.
2315
+
2094
2316
  ### value
2095
2317
 
2096
2318
  `T`
2097
2319
 
2320
+ The value to validate.
2321
+
2098
2322
  ### optional?
2099
2323
 
2100
2324
  `boolean` = `false`
2101
2325
 
2326
+ If true, undefined values are accepted without error.
2327
+
2102
2328
  ## Returns
2103
2329
 
2104
2330
  \[`T` \| `undefined`, `Error`[]\]
2105
2331
 
2332
+ A tuple of [value or undefined, array of errors].
2333
+
2106
2334
  ### type-aliases
2107
2335
 
2108
2336
  ### <a id="AnyFunction"></a>AnyFunction
@@ -2115,6 +2343,8 @@ function validateType<T>(
2115
2343
  type AnyFunction = (...args) => unknown;
2116
2344
  ```
2117
2345
 
2346
+ A function type that accepts any arguments and returns unknown.
2347
+
2118
2348
  ## Parameters
2119
2349
 
2120
2350
  ### args
@@ -2135,6 +2365,8 @@ type AnyFunction = (...args) => unknown;
2135
2365
  type Brand<T, B> = T & { [K in keyof B]: B[K] };
2136
2366
  ```
2137
2367
 
2368
+ Creates a branded type by intersecting base type T with brand type B, enabling nominal typing in TypeScript.
2369
+
2138
2370
  ## Type Parameters
2139
2371
 
2140
2372
  ### T
@@ -2163,6 +2395,8 @@ type FieldType =
2163
2395
  | "function";
2164
2396
  ```
2165
2397
 
2398
+ Union of string literals representing the possible types of an object field.
2399
+
2166
2400
  ### <a id="IdentityFunction"></a>IdentityFunction
2167
2401
 
2168
2402
  [**@xylabs/typeof**](#../README)
@@ -2173,6 +2407,8 @@ type FieldType =
2173
2407
  type IdentityFunction<T> = (value) => value is T;
2174
2408
  ```
2175
2409
 
2410
+ A type guard function that narrows an unknown value to type T.
2411
+
2176
2412
  ## Type Parameters
2177
2413
 
2178
2414
  ### T
@@ -2199,6 +2435,8 @@ type IdentityFunction<T> = (value) => value is T;
2199
2435
  type ObjectTypeShape = Record<string | number | symbol, FieldType>;
2200
2436
  ```
2201
2437
 
2438
+ Describes the expected shape of an object by mapping each key to its expected field type.
2439
+
2202
2440
  ### <a id="RecordKey"></a>RecordKey
2203
2441
 
2204
2442
  [**@xylabs/typeof**](#../README)
@@ -2209,6 +2447,8 @@ type ObjectTypeShape = Record<string | number | symbol, FieldType>;
2209
2447
  type RecordKey = string | number | symbol;
2210
2448
  ```
2211
2449
 
2450
+ A union of valid object key types.
2451
+
2212
2452
  ### <a id="TypeOfTypes"></a>TypeOfTypes
2213
2453
 
2214
2454
  [**@xylabs/typeof**](#../README)
@@ -2230,6 +2470,8 @@ type TypeOfTypes =
2230
2470
  | "symbol";
2231
2471
  ```
2232
2472
 
2473
+ Union of string literals representing the possible results of the extended `typeOf` function.
2474
+
2233
2475
  ### <a id="TypedArray"></a>TypedArray
2234
2476
 
2235
2477
  [**@xylabs/typeof**](#../README)
@@ -2240,6 +2482,8 @@ type TypeOfTypes =
2240
2482
  type TypedArray = TypedValue[];
2241
2483
  ```
2242
2484
 
2485
+ An array of TypedValue elements.
2486
+
2243
2487
  ### <a id="TypedKey"></a>TypedKey
2244
2488
 
2245
2489
  [**@xylabs/typeof**](#../README)
@@ -2250,6 +2494,8 @@ type TypedArray = TypedValue[];
2250
2494
  type TypedKey<T> = T extends string ? T : string | number | symbol;
2251
2495
  ```
2252
2496
 
2497
+ A valid key for a typed object. Defaults to string | number | symbol unless narrowed by T.
2498
+
2253
2499
  ## Type Parameters
2254
2500
 
2255
2501
  ### T
@@ -2270,6 +2516,8 @@ type TypedObject =
2270
2516
  | object;
2271
2517
  ```
2272
2518
 
2519
+ An object whose keys are TypedKey and whose values are TypedValue.
2520
+
2273
2521
  ### <a id="TypedValue"></a>TypedValue
2274
2522
 
2275
2523
  [**@xylabs/typeof**](#../README)
@@ -2290,6 +2538,8 @@ type TypedValue =
2290
2538
  | undefined;
2291
2539
  ```
2292
2540
 
2541
+ A value that can appear in a typed object tree (primitives, objects, arrays, functions, and symbols).
2542
+
2293
2543
 
2294
2544
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
2295
2545