@xylabs/typeof 5.0.94 → 5.0.96
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 +726 -716
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/is.d.ts +3 -3
- package/dist/neutral/is.d.ts.map +1 -1
- package/package.json +6 -10
package/README.md
CHANGED
|
@@ -1,119 +1,82 @@
|
|
|
1
1
|
# @xylabs/typeof
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![npm][npm-badge]][npm-link]
|
|
4
|
+
[![license][license-badge]][license-link]
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
[![npm-badge][]][npm-link]
|
|
7
|
-
[![npm-downloads-badge][]][npm-link]
|
|
8
|
-
[![jsdelivr-badge][]][jsdelivr-link]
|
|
9
|
-
[![npm-license-badge][]](LICENSE)
|
|
10
|
-
[![codacy-badge][]][codacy-link]
|
|
11
|
-
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
-
[![snyk-badge][]][snyk-link]
|
|
13
|
-
[![socket-badge][]][socket-link]
|
|
6
|
+
> Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
14
7
|
|
|
8
|
+
## Install
|
|
15
9
|
|
|
16
|
-
|
|
10
|
+
Using npm:
|
|
17
11
|
|
|
12
|
+
```sh
|
|
13
|
+
npm install {{name}}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Using yarn:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
yarn add {{name}}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Using pnpm:
|
|
18
23
|
|
|
24
|
+
```sh
|
|
25
|
+
pnpm add {{name}}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Using bun:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
bun add {{name}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
19
38
|
|
|
20
39
|
## Reference
|
|
21
40
|
|
|
22
|
-
|
|
41
|
+
### packages
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
### typeof
|
|
44
|
+
|
|
45
|
+
### .temp-typedoc
|
|
25
46
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
| ------ | ------ |
|
|
30
|
-
| [Brand](#type-aliases/Brand) | Creates a branded type by intersecting base type T with brand type B, enabling nominal typing in TypeScript. |
|
|
31
|
-
| [IdentityFunction](#type-aliases/IdentityFunction) | A type guard function that narrows an unknown value to type T. |
|
|
32
|
-
| [FieldType](#type-aliases/FieldType) | Union of string literals representing the possible types of an object field. |
|
|
33
|
-
| [ObjectTypeShape](#type-aliases/ObjectTypeShape) | Describes the expected shape of an object by mapping each key to its expected field type. |
|
|
34
|
-
| [TypeOfTypes](#type-aliases/TypeOfTypes) | Union of string literals representing the possible results of the extended `typeOf` function. |
|
|
35
|
-
| [TypedValue](#type-aliases/TypedValue) | A value that can appear in a typed object tree (primitives, objects, arrays, functions, and symbols). |
|
|
36
|
-
| [TypedKey](#type-aliases/TypedKey) | A valid key for a typed object. Defaults to string | number | symbol unless narrowed by T. |
|
|
37
|
-
| [TypedObject](#type-aliases/TypedObject) | An object whose keys are TypedKey and whose values are TypedValue. |
|
|
38
|
-
| [TypedArray](#type-aliases/TypedArray) | An array of TypedValue elements. |
|
|
39
|
-
| [AnyFunction](#type-aliases/AnyFunction) | A function type that accepts any arguments and returns unknown. |
|
|
40
|
-
| [RecordKey](#type-aliases/RecordKey) | A union of valid object key types. |
|
|
41
|
-
|
|
42
|
-
## Functions
|
|
43
|
-
|
|
44
|
-
| Function | Description |
|
|
45
|
-
| ------ | ------ |
|
|
46
|
-
| [isTypedKey](#functions/isTypedKey) | Type guard that checks whether a value is a valid TypedKey (string, bigint, number, or symbol). |
|
|
47
|
-
| [isTypedValue](#functions/isTypedValue) | Type guard that checks whether a value is a valid TypedValue. |
|
|
48
|
-
| [isTypedArray](#functions/isTypedArray) | Type guard that checks whether a value is a TypedArray (an array where every element is a TypedValue). |
|
|
49
|
-
| [isValidTypedFieldPair](#functions/isValidTypedFieldPair) | Type guard that checks whether a key-value pair has a valid TypedKey and TypedValue. |
|
|
50
|
-
| [isTypedObject](#functions/isTypedObject) | Type guard that checks whether a value is a TypedObject (an object with TypedKey keys and TypedValue values). |
|
|
51
|
-
| [ifDefined](#functions/ifDefined) | Invokes the callback only if the value is neither null nor undefined. |
|
|
52
|
-
| [ifTypeOf](#functions/ifTypeOf) | Invokes the callback if the value matches the specified type, with an optional additional predicate. |
|
|
53
|
-
| [isUndefined](#functions/isUndefined) | Type guard that checks whether a value is undefined. |
|
|
54
|
-
| [isDefined](#functions/isDefined) | Type guard that checks whether a value is not undefined. |
|
|
55
|
-
| [isNull](#functions/isNull) | Type guard that checks whether a value is null. |
|
|
56
|
-
| [isDefinedNotNull](#functions/isDefinedNotNull) | Type guard that checks whether a value is neither undefined nor null. |
|
|
57
|
-
| [isUndefinedOrNull](#functions/isUndefinedOrNull) | Type guard that checks whether a value is undefined or null. |
|
|
58
|
-
| [isBigInt](#functions/isBigInt) | Type guard that checks whether a value is a bigint. |
|
|
59
|
-
| [isString](#functions/isString) | Type guard that checks whether a value is a string. |
|
|
60
|
-
| [isNumber](#functions/isNumber) | Type guard that checks whether a value is a number. |
|
|
61
|
-
| [isObject](#functions/isObject) | Type guard that checks whether a value is a plain object (not null and not an array). |
|
|
62
|
-
| [isArray](#functions/isArray) | Type guard that checks whether a value is an array. |
|
|
63
|
-
| [isFunction](#functions/isFunction) | Type guard that checks whether a value is a function. |
|
|
64
|
-
| [isSymbol](#functions/isSymbol) | Type guard that checks whether a value is a symbol. |
|
|
65
|
-
| [isEmptyObject](#functions/isEmptyObject) | Type guard that checks whether a value is an object with no own keys. |
|
|
66
|
-
| [isEmptyString](#functions/isEmptyString) | Type guard that checks whether a value is an empty string. |
|
|
67
|
-
| [isEmptyArray](#functions/isEmptyArray) | Type guard that checks whether a value is an empty array. |
|
|
68
|
-
| [isPopulatedArray](#functions/isPopulatedArray) | Type guard that checks whether a value is a non-empty array. |
|
|
69
|
-
| [isEmpty](#functions/isEmpty) | Type guard that checks whether a value is empty (empty string, empty array, or empty object). |
|
|
70
|
-
| [isFalsy](#functions/isFalsy) | Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n). |
|
|
71
|
-
| [isTruthy](#functions/isTruthy) | Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n). |
|
|
72
|
-
| [isBoolean](#functions/isBoolean) | Type guard that checks whether a value is a boolean. |
|
|
73
|
-
| [isDateString](#functions/isDateString) | Type guard that checks whether a value is a string that can be parsed as a valid date. |
|
|
74
|
-
| [isDate](#functions/isDate) | Type guard that checks whether a value is a Date instance. |
|
|
75
|
-
| [isRegExp](#functions/isRegExp) | Type guard that checks whether a value is a RegExp instance. |
|
|
76
|
-
| [isError](#functions/isError) | Type guard that checks whether a value is an Error instance. |
|
|
77
|
-
| [isPromise](#functions/isPromise) | Type guard that checks whether a value is a Promise instance. |
|
|
78
|
-
| [isPromiseLike](#functions/isPromiseLike) | Type guard that checks whether a value is promise-like (has a `then` method). |
|
|
79
|
-
| [isMap](#functions/isMap) | Type guard that checks whether a value is a Map instance. |
|
|
80
|
-
| [isArrayBufferView](#functions/isArrayBufferView) | Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray or DataView). |
|
|
81
|
-
| [isSet](#functions/isSet) | Type guard that checks whether a value is a Set instance. |
|
|
82
|
-
| [isWeakMap](#functions/isWeakMap) | Type guard that checks whether a value is a WeakMap instance. |
|
|
83
|
-
| [isWeakSet](#functions/isWeakSet) | Type guard that checks whether a value is a WeakSet instance. |
|
|
84
|
-
| [isDataView](#functions/isDataView) | Type guard that checks whether a value is a DataView instance. |
|
|
85
|
-
| [isBlob](#functions/isBlob) | Type guard that checks whether a value is a Blob instance. |
|
|
86
|
-
| [isFile](#functions/isFile) | Type guard that checks whether a value is a File instance. |
|
|
87
|
-
| [isType](#functions/isType) | Checks whether a value matches the expected field type, with correct handling for arrays and nulls. |
|
|
88
|
-
| [typeOf](#functions/typeOf) | Extended typeof that distinguishes arrays from objects (unlike native `typeof`). |
|
|
89
|
-
| [validateType](#functions/validateType) | Validates that a value matches the expected type, returning the value and any errors. |
|
|
90
|
-
|
|
91
|
-
### functions
|
|
92
|
-
|
|
93
|
-
### <a id="ifDefined"></a>ifDefined
|
|
47
|
+
### functions
|
|
48
|
+
|
|
49
|
+
### <a id="ifDefined"></a>ifDefined
|
|
94
50
|
|
|
95
51
|
[**@xylabs/typeof**](#../README)
|
|
96
52
|
|
|
97
53
|
***
|
|
98
54
|
|
|
99
55
|
```ts
|
|
100
|
-
function ifDefined<T>(value
|
|
56
|
+
function ifDefined<T>(value, func): T | undefined;
|
|
101
57
|
```
|
|
102
58
|
|
|
103
59
|
Invokes the callback only if the value is neither null nor undefined.
|
|
104
60
|
|
|
105
61
|
## Type Parameters
|
|
106
62
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
63
|
+
### T
|
|
64
|
+
|
|
65
|
+
`T`
|
|
110
66
|
|
|
111
67
|
## Parameters
|
|
112
68
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
69
|
+
### value
|
|
70
|
+
|
|
71
|
+
`T`
|
|
72
|
+
|
|
73
|
+
The value to check.
|
|
74
|
+
|
|
75
|
+
### func
|
|
76
|
+
|
|
77
|
+
(`value`) => `void`
|
|
78
|
+
|
|
79
|
+
The callback to invoke with the value if it is defined.
|
|
117
80
|
|
|
118
81
|
## Returns
|
|
119
82
|
|
|
@@ -121,7 +84,7 @@ Invokes the callback only if the value is neither null nor undefined.
|
|
|
121
84
|
|
|
122
85
|
The value if defined, or undefined otherwise.
|
|
123
86
|
|
|
124
|
-
|
|
87
|
+
### <a id="ifTypeOf"></a>ifTypeOf
|
|
125
88
|
|
|
126
89
|
[**@xylabs/typeof**](#../README)
|
|
127
90
|
|
|
@@ -129,29 +92,49 @@ The value if defined, or undefined otherwise.
|
|
|
129
92
|
|
|
130
93
|
```ts
|
|
131
94
|
function ifTypeOf<T, R>(
|
|
132
|
-
typeName
|
|
133
|
-
value
|
|
134
|
-
trueFunc
|
|
135
|
-
isFunc
|
|
95
|
+
typeName,
|
|
96
|
+
value,
|
|
97
|
+
trueFunc,
|
|
98
|
+
isFunc?): R | undefined;
|
|
136
99
|
```
|
|
137
100
|
|
|
138
101
|
Invokes the callback if the value matches the specified type, with an optional additional predicate.
|
|
139
102
|
|
|
140
103
|
## Type Parameters
|
|
141
104
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
105
|
+
### T
|
|
106
|
+
|
|
107
|
+
`T`
|
|
108
|
+
|
|
109
|
+
### R
|
|
110
|
+
|
|
111
|
+
`R`
|
|
146
112
|
|
|
147
113
|
## Parameters
|
|
148
114
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
115
|
+
### typeName
|
|
116
|
+
|
|
117
|
+
[`TypeOfTypes`](#../type-aliases/TypeOfTypes)
|
|
118
|
+
|
|
119
|
+
The expected type name to match against.
|
|
120
|
+
|
|
121
|
+
### value
|
|
122
|
+
|
|
123
|
+
`unknown`
|
|
124
|
+
|
|
125
|
+
The value to check.
|
|
126
|
+
|
|
127
|
+
### trueFunc
|
|
128
|
+
|
|
129
|
+
(`value`) => `R`
|
|
130
|
+
|
|
131
|
+
The callback to invoke if the type matches.
|
|
132
|
+
|
|
133
|
+
### isFunc?
|
|
134
|
+
|
|
135
|
+
(`value`) => `boolean`
|
|
136
|
+
|
|
137
|
+
Optional additional predicate that must also return true.
|
|
155
138
|
|
|
156
139
|
## Returns
|
|
157
140
|
|
|
@@ -159,7 +142,7 @@ Invokes the callback if the value matches the specified type, with an optional a
|
|
|
159
142
|
|
|
160
143
|
The result of trueFunc if the type matches (and isFunc passes), or undefined.
|
|
161
144
|
|
|
162
|
-
|
|
145
|
+
### <a id="isArray"></a>isArray
|
|
163
146
|
|
|
164
147
|
[**@xylabs/typeof**](#../README)
|
|
165
148
|
|
|
@@ -168,16 +151,16 @@ The result of trueFunc if the type matches (and isFunc passes), or undefined.
|
|
|
168
151
|
## Call Signature
|
|
169
152
|
|
|
170
153
|
```ts
|
|
171
|
-
function isArray(value
|
|
154
|
+
function isArray(value): value is readonly unknown[];
|
|
172
155
|
```
|
|
173
156
|
|
|
174
157
|
Type guard that checks whether a value is an array.
|
|
175
158
|
|
|
176
159
|
### Parameters
|
|
177
160
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
161
|
+
### value
|
|
162
|
+
|
|
163
|
+
`unknown`
|
|
181
164
|
|
|
182
165
|
### Returns
|
|
183
166
|
|
|
@@ -186,28 +169,28 @@ Type guard that checks whether a value is an array.
|
|
|
186
169
|
## Call Signature
|
|
187
170
|
|
|
188
171
|
```ts
|
|
189
|
-
function isArray<T>(value
|
|
172
|
+
function isArray<T>(value): value is Extract<T, readonly unknown[]>;
|
|
190
173
|
```
|
|
191
174
|
|
|
192
175
|
Type guard that checks whether a value is an array.
|
|
193
176
|
|
|
194
177
|
### Type Parameters
|
|
195
178
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
### T
|
|
180
|
+
|
|
181
|
+
`T`
|
|
199
182
|
|
|
200
183
|
### Parameters
|
|
201
184
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
185
|
+
### value
|
|
186
|
+
|
|
187
|
+
`T`
|
|
205
188
|
|
|
206
189
|
### Returns
|
|
207
190
|
|
|
208
191
|
`value is Extract<T, readonly unknown[]>`
|
|
209
192
|
|
|
210
|
-
|
|
193
|
+
### <a id="isArrayBufferView"></a>isArrayBufferView
|
|
211
194
|
|
|
212
195
|
[**@xylabs/typeof**](#../README)
|
|
213
196
|
|
|
@@ -216,16 +199,16 @@ Type guard that checks whether a value is an array.
|
|
|
216
199
|
## Call Signature
|
|
217
200
|
|
|
218
201
|
```ts
|
|
219
|
-
function isArrayBufferView(value
|
|
202
|
+
function isArrayBufferView(value): value is ArrayBufferView<ArrayBufferLike>;
|
|
220
203
|
```
|
|
221
204
|
|
|
222
205
|
Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray or DataView).
|
|
223
206
|
|
|
224
207
|
### Parameters
|
|
225
208
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
209
|
+
### value
|
|
210
|
+
|
|
211
|
+
`unknown`
|
|
229
212
|
|
|
230
213
|
### Returns
|
|
231
214
|
|
|
@@ -234,28 +217,28 @@ Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray o
|
|
|
234
217
|
## Call Signature
|
|
235
218
|
|
|
236
219
|
```ts
|
|
237
|
-
function isArrayBufferView<T>(value
|
|
220
|
+
function isArrayBufferView<T>(value): value is Extract<T, ArrayBufferView<ArrayBufferLike>>;
|
|
238
221
|
```
|
|
239
222
|
|
|
240
223
|
Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray or DataView).
|
|
241
224
|
|
|
242
225
|
### Type Parameters
|
|
243
226
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
227
|
+
### T
|
|
228
|
+
|
|
229
|
+
`T` *extends* `ArrayBufferView`\<`ArrayBufferLike`\>
|
|
247
230
|
|
|
248
231
|
### Parameters
|
|
249
232
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
233
|
+
### value
|
|
234
|
+
|
|
235
|
+
`T`
|
|
253
236
|
|
|
254
237
|
### Returns
|
|
255
238
|
|
|
256
239
|
`value is Extract<T, ArrayBufferView<ArrayBufferLike>>`
|
|
257
240
|
|
|
258
|
-
|
|
241
|
+
### <a id="isBigInt"></a>isBigInt
|
|
259
242
|
|
|
260
243
|
[**@xylabs/typeof**](#../README)
|
|
261
244
|
|
|
@@ -264,16 +247,16 @@ Type guard that checks whether a value is an ArrayBufferView (e.g., TypedArray o
|
|
|
264
247
|
## Call Signature
|
|
265
248
|
|
|
266
249
|
```ts
|
|
267
|
-
function isBigInt(value
|
|
250
|
+
function isBigInt(value): value is bigint;
|
|
268
251
|
```
|
|
269
252
|
|
|
270
253
|
Type guard that checks whether a value is a bigint.
|
|
271
254
|
|
|
272
255
|
### Parameters
|
|
273
256
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
257
|
+
### value
|
|
258
|
+
|
|
259
|
+
`unknown`
|
|
277
260
|
|
|
278
261
|
### Returns
|
|
279
262
|
|
|
@@ -282,28 +265,28 @@ Type guard that checks whether a value is a bigint.
|
|
|
282
265
|
## Call Signature
|
|
283
266
|
|
|
284
267
|
```ts
|
|
285
|
-
function isBigInt<T>(value
|
|
268
|
+
function isBigInt<T>(value): value is Extract<T, bigint>;
|
|
286
269
|
```
|
|
287
270
|
|
|
288
271
|
Type guard that checks whether a value is a bigint.
|
|
289
272
|
|
|
290
273
|
### Type Parameters
|
|
291
274
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
### T
|
|
276
|
+
|
|
277
|
+
`T` *extends* `bigint`
|
|
295
278
|
|
|
296
279
|
### Parameters
|
|
297
280
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
281
|
+
### value
|
|
282
|
+
|
|
283
|
+
`T`
|
|
301
284
|
|
|
302
285
|
### Returns
|
|
303
286
|
|
|
304
287
|
`value is Extract<T, bigint>`
|
|
305
288
|
|
|
306
|
-
|
|
289
|
+
### <a id="isBlob"></a>isBlob
|
|
307
290
|
|
|
308
291
|
[**@xylabs/typeof**](#../README)
|
|
309
292
|
|
|
@@ -312,16 +295,16 @@ Type guard that checks whether a value is a bigint.
|
|
|
312
295
|
## Call Signature
|
|
313
296
|
|
|
314
297
|
```ts
|
|
315
|
-
function isBlob(value
|
|
298
|
+
function isBlob(value): value is Blob;
|
|
316
299
|
```
|
|
317
300
|
|
|
318
301
|
Type guard that checks whether a value is a Blob instance.
|
|
319
302
|
|
|
320
303
|
### Parameters
|
|
321
304
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
305
|
+
### value
|
|
306
|
+
|
|
307
|
+
`unknown`
|
|
325
308
|
|
|
326
309
|
### Returns
|
|
327
310
|
|
|
@@ -330,28 +313,28 @@ Type guard that checks whether a value is a Blob instance.
|
|
|
330
313
|
## Call Signature
|
|
331
314
|
|
|
332
315
|
```ts
|
|
333
|
-
function isBlob<T>(value
|
|
316
|
+
function isBlob<T>(value): value is Extract<T, Blob>;
|
|
334
317
|
```
|
|
335
318
|
|
|
336
319
|
Type guard that checks whether a value is a Blob instance.
|
|
337
320
|
|
|
338
321
|
### Type Parameters
|
|
339
322
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
323
|
+
### T
|
|
324
|
+
|
|
325
|
+
`T` *extends* `Blob`
|
|
343
326
|
|
|
344
327
|
### Parameters
|
|
345
328
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
329
|
+
### value
|
|
330
|
+
|
|
331
|
+
`T`
|
|
349
332
|
|
|
350
333
|
### Returns
|
|
351
334
|
|
|
352
335
|
`value is Extract<T, Blob>`
|
|
353
336
|
|
|
354
|
-
|
|
337
|
+
### <a id="isBoolean"></a>isBoolean
|
|
355
338
|
|
|
356
339
|
[**@xylabs/typeof**](#../README)
|
|
357
340
|
|
|
@@ -360,16 +343,16 @@ Type guard that checks whether a value is a Blob instance.
|
|
|
360
343
|
## Call Signature
|
|
361
344
|
|
|
362
345
|
```ts
|
|
363
|
-
function isBoolean(value
|
|
346
|
+
function isBoolean(value): value is boolean;
|
|
364
347
|
```
|
|
365
348
|
|
|
366
349
|
Type guard that checks whether a value is a boolean.
|
|
367
350
|
|
|
368
351
|
### Parameters
|
|
369
352
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
353
|
+
### value
|
|
354
|
+
|
|
355
|
+
`unknown`
|
|
373
356
|
|
|
374
357
|
### Returns
|
|
375
358
|
|
|
@@ -378,28 +361,28 @@ Type guard that checks whether a value is a boolean.
|
|
|
378
361
|
## Call Signature
|
|
379
362
|
|
|
380
363
|
```ts
|
|
381
|
-
function isBoolean<T>(value
|
|
364
|
+
function isBoolean<T>(value): value is Extract<T, boolean>;
|
|
382
365
|
```
|
|
383
366
|
|
|
384
367
|
Type guard that checks whether a value is a boolean.
|
|
385
368
|
|
|
386
369
|
### Type Parameters
|
|
387
370
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
371
|
+
### T
|
|
372
|
+
|
|
373
|
+
`T` *extends* `boolean`
|
|
391
374
|
|
|
392
375
|
### Parameters
|
|
393
376
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
377
|
+
### value
|
|
378
|
+
|
|
379
|
+
`T`
|
|
397
380
|
|
|
398
381
|
### Returns
|
|
399
382
|
|
|
400
383
|
`value is Extract<T, boolean>`
|
|
401
384
|
|
|
402
|
-
|
|
385
|
+
### <a id="isDataView"></a>isDataView
|
|
403
386
|
|
|
404
387
|
[**@xylabs/typeof**](#../README)
|
|
405
388
|
|
|
@@ -408,16 +391,16 @@ Type guard that checks whether a value is a boolean.
|
|
|
408
391
|
## Call Signature
|
|
409
392
|
|
|
410
393
|
```ts
|
|
411
|
-
function isDataView(value
|
|
394
|
+
function isDataView(value): value is DataView<ArrayBufferLike>;
|
|
412
395
|
```
|
|
413
396
|
|
|
414
397
|
Type guard that checks whether a value is a DataView instance.
|
|
415
398
|
|
|
416
399
|
### Parameters
|
|
417
400
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
401
|
+
### value
|
|
402
|
+
|
|
403
|
+
`unknown`
|
|
421
404
|
|
|
422
405
|
### Returns
|
|
423
406
|
|
|
@@ -426,28 +409,28 @@ Type guard that checks whether a value is a DataView instance.
|
|
|
426
409
|
## Call Signature
|
|
427
410
|
|
|
428
411
|
```ts
|
|
429
|
-
function isDataView<T>(value
|
|
412
|
+
function isDataView<T>(value): value is Extract<T, DataView<ArrayBufferLike>>;
|
|
430
413
|
```
|
|
431
414
|
|
|
432
415
|
Type guard that checks whether a value is a DataView instance.
|
|
433
416
|
|
|
434
417
|
### Type Parameters
|
|
435
418
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
419
|
+
### T
|
|
420
|
+
|
|
421
|
+
`T`
|
|
439
422
|
|
|
440
423
|
### Parameters
|
|
441
424
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
425
|
+
### value
|
|
426
|
+
|
|
427
|
+
`T`
|
|
445
428
|
|
|
446
429
|
### Returns
|
|
447
430
|
|
|
448
431
|
`value is Extract<T, DataView<ArrayBufferLike>>`
|
|
449
432
|
|
|
450
|
-
|
|
433
|
+
### <a id="isDate"></a>isDate
|
|
451
434
|
|
|
452
435
|
[**@xylabs/typeof**](#../README)
|
|
453
436
|
|
|
@@ -456,16 +439,16 @@ Type guard that checks whether a value is a DataView instance.
|
|
|
456
439
|
## Call Signature
|
|
457
440
|
|
|
458
441
|
```ts
|
|
459
|
-
function isDate(value
|
|
442
|
+
function isDate(value): value is Date;
|
|
460
443
|
```
|
|
461
444
|
|
|
462
445
|
Type guard that checks whether a value is a Date instance.
|
|
463
446
|
|
|
464
447
|
### Parameters
|
|
465
448
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
449
|
+
### value
|
|
450
|
+
|
|
451
|
+
`unknown`
|
|
469
452
|
|
|
470
453
|
### Returns
|
|
471
454
|
|
|
@@ -474,28 +457,28 @@ Type guard that checks whether a value is a Date instance.
|
|
|
474
457
|
## Call Signature
|
|
475
458
|
|
|
476
459
|
```ts
|
|
477
|
-
function isDate<T>(value
|
|
460
|
+
function isDate<T>(value): value is Extract<T, Date>;
|
|
478
461
|
```
|
|
479
462
|
|
|
480
463
|
Type guard that checks whether a value is a Date instance.
|
|
481
464
|
|
|
482
465
|
### Type Parameters
|
|
483
466
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
467
|
+
### T
|
|
468
|
+
|
|
469
|
+
`T`
|
|
487
470
|
|
|
488
471
|
### Parameters
|
|
489
472
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
473
|
+
### value
|
|
474
|
+
|
|
475
|
+
`T`
|
|
493
476
|
|
|
494
477
|
### Returns
|
|
495
478
|
|
|
496
479
|
`value is Extract<T, Date>`
|
|
497
480
|
|
|
498
|
-
|
|
481
|
+
### <a id="isDateString"></a>isDateString
|
|
499
482
|
|
|
500
483
|
[**@xylabs/typeof**](#../README)
|
|
501
484
|
|
|
@@ -504,16 +487,16 @@ Type guard that checks whether a value is a Date instance.
|
|
|
504
487
|
## Call Signature
|
|
505
488
|
|
|
506
489
|
```ts
|
|
507
|
-
function isDateString(value
|
|
490
|
+
function isDateString(value): value is string;
|
|
508
491
|
```
|
|
509
492
|
|
|
510
493
|
Type guard that checks whether a value is a string that can be parsed as a valid date.
|
|
511
494
|
|
|
512
495
|
### Parameters
|
|
513
496
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
497
|
+
### value
|
|
498
|
+
|
|
499
|
+
`unknown`
|
|
517
500
|
|
|
518
501
|
### Returns
|
|
519
502
|
|
|
@@ -522,84 +505,84 @@ Type guard that checks whether a value is a string that can be parsed as a valid
|
|
|
522
505
|
## Call Signature
|
|
523
506
|
|
|
524
507
|
```ts
|
|
525
|
-
function isDateString<T>(value
|
|
508
|
+
function isDateString<T>(value): value is Extract<T, string>;
|
|
526
509
|
```
|
|
527
510
|
|
|
528
511
|
Type guard that checks whether a value is a string that can be parsed as a valid date.
|
|
529
512
|
|
|
530
513
|
### Type Parameters
|
|
531
514
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
515
|
+
### T
|
|
516
|
+
|
|
517
|
+
`T`
|
|
535
518
|
|
|
536
519
|
### Parameters
|
|
537
520
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
521
|
+
### value
|
|
522
|
+
|
|
523
|
+
`T`
|
|
541
524
|
|
|
542
525
|
### Returns
|
|
543
526
|
|
|
544
527
|
`value is Extract<T, string>`
|
|
545
528
|
|
|
546
|
-
|
|
529
|
+
### <a id="isDefined"></a>isDefined
|
|
547
530
|
|
|
548
531
|
[**@xylabs/typeof**](#../README)
|
|
549
532
|
|
|
550
533
|
***
|
|
551
534
|
|
|
552
535
|
```ts
|
|
553
|
-
function isDefined<T>(value
|
|
536
|
+
function isDefined<T>(value): value is Exclude<T, undefined>;
|
|
554
537
|
```
|
|
555
538
|
|
|
556
539
|
Type guard that checks whether a value is not undefined.
|
|
557
540
|
|
|
558
541
|
## Type Parameters
|
|
559
542
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
543
|
+
### T
|
|
544
|
+
|
|
545
|
+
`T`
|
|
563
546
|
|
|
564
547
|
## Parameters
|
|
565
548
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
549
|
+
### value
|
|
550
|
+
|
|
551
|
+
`T`
|
|
569
552
|
|
|
570
553
|
## Returns
|
|
571
554
|
|
|
572
555
|
`value is Exclude<T, undefined>`
|
|
573
556
|
|
|
574
|
-
|
|
557
|
+
### <a id="isDefinedNotNull"></a>isDefinedNotNull
|
|
575
558
|
|
|
576
559
|
[**@xylabs/typeof**](#../README)
|
|
577
560
|
|
|
578
561
|
***
|
|
579
562
|
|
|
580
563
|
```ts
|
|
581
|
-
function isDefinedNotNull<T>(value
|
|
564
|
+
function isDefinedNotNull<T>(value): value is Exclude<T, null | undefined>;
|
|
582
565
|
```
|
|
583
566
|
|
|
584
567
|
Type guard that checks whether a value is neither undefined nor null.
|
|
585
568
|
|
|
586
569
|
## Type Parameters
|
|
587
570
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
571
|
+
### T
|
|
572
|
+
|
|
573
|
+
`T`
|
|
591
574
|
|
|
592
575
|
## Parameters
|
|
593
576
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
577
|
+
### value
|
|
578
|
+
|
|
579
|
+
`T`
|
|
597
580
|
|
|
598
581
|
## Returns
|
|
599
582
|
|
|
600
583
|
value is Exclude\<T, null \| undefined\>
|
|
601
584
|
|
|
602
|
-
|
|
585
|
+
### <a id="isEmpty"></a>isEmpty
|
|
603
586
|
|
|
604
587
|
[**@xylabs/typeof**](#../README)
|
|
605
588
|
|
|
@@ -608,22 +591,22 @@ value is Exclude\<T, null \| undefined\>
|
|
|
608
591
|
## Call Signature
|
|
609
592
|
|
|
610
593
|
```ts
|
|
611
|
-
function isEmpty<T>(value
|
|
594
|
+
function isEmpty<T>(value): value is T;
|
|
612
595
|
```
|
|
613
596
|
|
|
614
597
|
Type guard that checks whether a value is empty (empty string, empty array, or empty object).
|
|
615
598
|
|
|
616
599
|
### Type Parameters
|
|
617
600
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
601
|
+
### T
|
|
602
|
+
|
|
603
|
+
`T`
|
|
621
604
|
|
|
622
605
|
### Parameters
|
|
623
606
|
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
607
|
+
### value
|
|
608
|
+
|
|
609
|
+
`unknown`
|
|
627
610
|
|
|
628
611
|
### Returns
|
|
629
612
|
|
|
@@ -632,24 +615,30 @@ Type guard that checks whether a value is empty (empty string, empty array, or e
|
|
|
632
615
|
## Call Signature
|
|
633
616
|
|
|
634
617
|
```ts
|
|
635
|
-
function isEmpty<K, V, T>(value
|
|
618
|
+
function isEmpty<K, V, T>(value): value is Extract<T, Record<K, never>>;
|
|
636
619
|
```
|
|
637
620
|
|
|
638
621
|
Type guard that checks whether a value is empty (empty string, empty array, or empty object).
|
|
639
622
|
|
|
640
623
|
### Type Parameters
|
|
641
624
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
625
|
+
### K
|
|
626
|
+
|
|
627
|
+
`K` *extends* [`RecordKey`](#../type-aliases/RecordKey)
|
|
628
|
+
|
|
629
|
+
### V
|
|
630
|
+
|
|
631
|
+
`V`
|
|
632
|
+
|
|
633
|
+
### T
|
|
634
|
+
|
|
635
|
+
`T` *extends* `Record`\<`K`, `V`\>
|
|
647
636
|
|
|
648
637
|
### Parameters
|
|
649
638
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
639
|
+
### value
|
|
640
|
+
|
|
641
|
+
`T`
|
|
653
642
|
|
|
654
643
|
### Returns
|
|
655
644
|
|
|
@@ -658,28 +647,28 @@ Type guard that checks whether a value is empty (empty string, empty array, or e
|
|
|
658
647
|
## Call Signature
|
|
659
648
|
|
|
660
649
|
```ts
|
|
661
|
-
function isEmpty<T>(value
|
|
650
|
+
function isEmpty<T>(value): value is Extract<T, never[]>;
|
|
662
651
|
```
|
|
663
652
|
|
|
664
653
|
Type guard that checks whether a value is empty (empty string, empty array, or empty object).
|
|
665
654
|
|
|
666
655
|
### Type Parameters
|
|
667
656
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
657
|
+
### T
|
|
658
|
+
|
|
659
|
+
`T` *extends* `unknown`[]
|
|
671
660
|
|
|
672
661
|
### Parameters
|
|
673
662
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
663
|
+
### value
|
|
664
|
+
|
|
665
|
+
`T`
|
|
677
666
|
|
|
678
667
|
### Returns
|
|
679
668
|
|
|
680
669
|
`value is Extract<T, never[]>`
|
|
681
670
|
|
|
682
|
-
|
|
671
|
+
### <a id="isEmptyArray"></a>isEmptyArray
|
|
683
672
|
|
|
684
673
|
[**@xylabs/typeof**](#../README)
|
|
685
674
|
|
|
@@ -688,16 +677,16 @@ Type guard that checks whether a value is empty (empty string, empty array, or e
|
|
|
688
677
|
## Call Signature
|
|
689
678
|
|
|
690
679
|
```ts
|
|
691
|
-
function isEmptyArray(value
|
|
680
|
+
function isEmptyArray(value): value is [];
|
|
692
681
|
```
|
|
693
682
|
|
|
694
683
|
Type guard that checks whether a value is an empty array.
|
|
695
684
|
|
|
696
685
|
### Parameters
|
|
697
686
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
687
|
+
### value
|
|
688
|
+
|
|
689
|
+
`unknown`
|
|
701
690
|
|
|
702
691
|
### Returns
|
|
703
692
|
|
|
@@ -706,28 +695,28 @@ Type guard that checks whether a value is an empty array.
|
|
|
706
695
|
## Call Signature
|
|
707
696
|
|
|
708
697
|
```ts
|
|
709
|
-
function isEmptyArray<T>(value
|
|
698
|
+
function isEmptyArray<T>(value): value is Extract<T, unknown[]>;
|
|
710
699
|
```
|
|
711
700
|
|
|
712
701
|
Type guard that checks whether a value is an empty array.
|
|
713
702
|
|
|
714
703
|
### Type Parameters
|
|
715
704
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
705
|
+
### T
|
|
706
|
+
|
|
707
|
+
`T` *extends* `unknown`[]
|
|
719
708
|
|
|
720
709
|
### Parameters
|
|
721
710
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
711
|
+
### value
|
|
712
|
+
|
|
713
|
+
`T`
|
|
725
714
|
|
|
726
715
|
### Returns
|
|
727
716
|
|
|
728
717
|
`value is Extract<T, unknown[]>`
|
|
729
718
|
|
|
730
|
-
|
|
719
|
+
### <a id="isEmptyObject"></a>isEmptyObject
|
|
731
720
|
|
|
732
721
|
[**@xylabs/typeof**](#../README)
|
|
733
722
|
|
|
@@ -736,16 +725,16 @@ Type guard that checks whether a value is an empty array.
|
|
|
736
725
|
## Call Signature
|
|
737
726
|
|
|
738
727
|
```ts
|
|
739
|
-
function isEmptyObject(value
|
|
728
|
+
function isEmptyObject(value): value is {};
|
|
740
729
|
```
|
|
741
730
|
|
|
742
731
|
Type guard that checks whether a value is an object with no own keys.
|
|
743
732
|
|
|
744
733
|
### Parameters
|
|
745
734
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
735
|
+
### value
|
|
736
|
+
|
|
737
|
+
`unknown`
|
|
749
738
|
|
|
750
739
|
### Returns
|
|
751
740
|
|
|
@@ -754,30 +743,36 @@ Type guard that checks whether a value is an object with no own keys.
|
|
|
754
743
|
## Call Signature
|
|
755
744
|
|
|
756
745
|
```ts
|
|
757
|
-
function isEmptyObject<K, V, T>(value
|
|
746
|
+
function isEmptyObject<K, V, T>(value): value is Extract<T, Record<K, never>>;
|
|
758
747
|
```
|
|
759
748
|
|
|
760
749
|
Type guard that checks whether a value is an object with no own keys.
|
|
761
750
|
|
|
762
751
|
### Type Parameters
|
|
763
752
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
753
|
+
### K
|
|
754
|
+
|
|
755
|
+
`K` *extends* [`RecordKey`](#../type-aliases/RecordKey)
|
|
756
|
+
|
|
757
|
+
### V
|
|
758
|
+
|
|
759
|
+
`V`
|
|
760
|
+
|
|
761
|
+
### T
|
|
762
|
+
|
|
763
|
+
`T` *extends* `Record`\<`K`, `V`\>
|
|
769
764
|
|
|
770
765
|
### Parameters
|
|
771
766
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
767
|
+
### value
|
|
768
|
+
|
|
769
|
+
`T`
|
|
775
770
|
|
|
776
771
|
### Returns
|
|
777
772
|
|
|
778
773
|
`value is Extract<T, Record<K, never>>`
|
|
779
774
|
|
|
780
|
-
|
|
775
|
+
### <a id="isEmptyString"></a>isEmptyString
|
|
781
776
|
|
|
782
777
|
[**@xylabs/typeof**](#../README)
|
|
783
778
|
|
|
@@ -786,16 +781,16 @@ Type guard that checks whether a value is an object with no own keys.
|
|
|
786
781
|
## Call Signature
|
|
787
782
|
|
|
788
783
|
```ts
|
|
789
|
-
function isEmptyString(value
|
|
784
|
+
function isEmptyString(value): value is "";
|
|
790
785
|
```
|
|
791
786
|
|
|
792
787
|
Type guard that checks whether a value is an empty string.
|
|
793
788
|
|
|
794
789
|
### Parameters
|
|
795
790
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
791
|
+
### value
|
|
792
|
+
|
|
793
|
+
`unknown`
|
|
799
794
|
|
|
800
795
|
### Returns
|
|
801
796
|
|
|
@@ -804,28 +799,28 @@ Type guard that checks whether a value is an empty string.
|
|
|
804
799
|
## Call Signature
|
|
805
800
|
|
|
806
801
|
```ts
|
|
807
|
-
function isEmptyString<T>(value
|
|
802
|
+
function isEmptyString<T>(value): value is Extract<T, "">;
|
|
808
803
|
```
|
|
809
804
|
|
|
810
805
|
Type guard that checks whether a value is an empty string.
|
|
811
806
|
|
|
812
807
|
### Type Parameters
|
|
813
808
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
809
|
+
### T
|
|
810
|
+
|
|
811
|
+
`T` *extends* `string`
|
|
817
812
|
|
|
818
813
|
### Parameters
|
|
819
814
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
815
|
+
### value
|
|
816
|
+
|
|
817
|
+
`T`
|
|
823
818
|
|
|
824
819
|
### Returns
|
|
825
820
|
|
|
826
821
|
`value is Extract<T, "">`
|
|
827
822
|
|
|
828
|
-
|
|
823
|
+
### <a id="isError"></a>isError
|
|
829
824
|
|
|
830
825
|
[**@xylabs/typeof**](#../README)
|
|
831
826
|
|
|
@@ -834,16 +829,16 @@ Type guard that checks whether a value is an empty string.
|
|
|
834
829
|
## Call Signature
|
|
835
830
|
|
|
836
831
|
```ts
|
|
837
|
-
function isError(value
|
|
832
|
+
function isError(value): value is Error;
|
|
838
833
|
```
|
|
839
834
|
|
|
840
835
|
Type guard that checks whether a value is an Error instance.
|
|
841
836
|
|
|
842
837
|
### Parameters
|
|
843
838
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
839
|
+
### value
|
|
840
|
+
|
|
841
|
+
`unknown`
|
|
847
842
|
|
|
848
843
|
### Returns
|
|
849
844
|
|
|
@@ -852,28 +847,28 @@ Type guard that checks whether a value is an Error instance.
|
|
|
852
847
|
## Call Signature
|
|
853
848
|
|
|
854
849
|
```ts
|
|
855
|
-
function isError<T>(value
|
|
850
|
+
function isError<T>(value): value is Extract<T, Error>;
|
|
856
851
|
```
|
|
857
852
|
|
|
858
853
|
Type guard that checks whether a value is an Error instance.
|
|
859
854
|
|
|
860
855
|
### Type Parameters
|
|
861
856
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
857
|
+
### T
|
|
858
|
+
|
|
859
|
+
`T`
|
|
865
860
|
|
|
866
861
|
### Parameters
|
|
867
862
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
863
|
+
### value
|
|
864
|
+
|
|
865
|
+
`T`
|
|
871
866
|
|
|
872
867
|
### Returns
|
|
873
868
|
|
|
874
869
|
`value is Extract<T, Error>`
|
|
875
870
|
|
|
876
|
-
|
|
871
|
+
### <a id="isFalsy"></a>isFalsy
|
|
877
872
|
|
|
878
873
|
[**@xylabs/typeof**](#../README)
|
|
879
874
|
|
|
@@ -882,22 +877,22 @@ Type guard that checks whether a value is an Error instance.
|
|
|
882
877
|
## Call Signature
|
|
883
878
|
|
|
884
879
|
```ts
|
|
885
|
-
function isFalsy<T>(value
|
|
880
|
+
function isFalsy<T>(value): value is Extract<T, false | "" | 0 | 0n | null | undefined>;
|
|
886
881
|
```
|
|
887
882
|
|
|
888
883
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
889
884
|
|
|
890
885
|
### Type Parameters
|
|
891
886
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
887
|
+
### T
|
|
888
|
+
|
|
889
|
+
`T`
|
|
895
890
|
|
|
896
891
|
### Parameters
|
|
897
892
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
893
|
+
### value
|
|
894
|
+
|
|
895
|
+
`T`
|
|
901
896
|
|
|
902
897
|
### Returns
|
|
903
898
|
|
|
@@ -906,22 +901,22 @@ value is Extract\<T, false \| "" \| 0 \| 0n \| null \| undefined\>
|
|
|
906
901
|
## Call Signature
|
|
907
902
|
|
|
908
903
|
```ts
|
|
909
|
-
function isFalsy<T>(value
|
|
904
|
+
function isFalsy<T>(value): value is Extract<T, false>;
|
|
910
905
|
```
|
|
911
906
|
|
|
912
907
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
913
908
|
|
|
914
909
|
### Type Parameters
|
|
915
910
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
911
|
+
### T
|
|
912
|
+
|
|
913
|
+
`T` *extends* `boolean`
|
|
919
914
|
|
|
920
915
|
### Parameters
|
|
921
916
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
917
|
+
### value
|
|
918
|
+
|
|
919
|
+
`T`
|
|
925
920
|
|
|
926
921
|
### Returns
|
|
927
922
|
|
|
@@ -930,22 +925,22 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
930
925
|
## Call Signature
|
|
931
926
|
|
|
932
927
|
```ts
|
|
933
|
-
function isFalsy<T>(value
|
|
928
|
+
function isFalsy<T>(value): value is Extract<T, 0>;
|
|
934
929
|
```
|
|
935
930
|
|
|
936
931
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
937
932
|
|
|
938
933
|
### Type Parameters
|
|
939
934
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
935
|
+
### T
|
|
936
|
+
|
|
937
|
+
`T` *extends* `number`
|
|
943
938
|
|
|
944
939
|
### Parameters
|
|
945
940
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
941
|
+
### value
|
|
942
|
+
|
|
943
|
+
`T`
|
|
949
944
|
|
|
950
945
|
### Returns
|
|
951
946
|
|
|
@@ -954,22 +949,22 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
954
949
|
## Call Signature
|
|
955
950
|
|
|
956
951
|
```ts
|
|
957
|
-
function isFalsy<T>(value
|
|
952
|
+
function isFalsy<T>(value): value is Extract<T, 0n>;
|
|
958
953
|
```
|
|
959
954
|
|
|
960
955
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
961
956
|
|
|
962
957
|
### Type Parameters
|
|
963
958
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
959
|
+
### T
|
|
960
|
+
|
|
961
|
+
`T` *extends* `bigint`
|
|
967
962
|
|
|
968
963
|
### Parameters
|
|
969
964
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
965
|
+
### value
|
|
966
|
+
|
|
967
|
+
`T`
|
|
973
968
|
|
|
974
969
|
### Returns
|
|
975
970
|
|
|
@@ -978,22 +973,22 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
978
973
|
## Call Signature
|
|
979
974
|
|
|
980
975
|
```ts
|
|
981
|
-
function isFalsy<T>(value
|
|
976
|
+
function isFalsy<T>(value): value is Extract<T, null>;
|
|
982
977
|
```
|
|
983
978
|
|
|
984
979
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
985
980
|
|
|
986
981
|
### Type Parameters
|
|
987
982
|
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
983
|
+
### T
|
|
984
|
+
|
|
985
|
+
`T` *extends* `null`
|
|
991
986
|
|
|
992
987
|
### Parameters
|
|
993
988
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
989
|
+
### value
|
|
990
|
+
|
|
991
|
+
`T`
|
|
997
992
|
|
|
998
993
|
### Returns
|
|
999
994
|
|
|
@@ -1002,22 +997,22 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
1002
997
|
## Call Signature
|
|
1003
998
|
|
|
1004
999
|
```ts
|
|
1005
|
-
function isFalsy<T>(value
|
|
1000
|
+
function isFalsy<T>(value): value is Extract<T, undefined>;
|
|
1006
1001
|
```
|
|
1007
1002
|
|
|
1008
1003
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
1009
1004
|
|
|
1010
1005
|
### Type Parameters
|
|
1011
1006
|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1007
|
+
### T
|
|
1008
|
+
|
|
1009
|
+
`T` *extends* `undefined`
|
|
1015
1010
|
|
|
1016
1011
|
### Parameters
|
|
1017
1012
|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1013
|
+
### value
|
|
1014
|
+
|
|
1015
|
+
`T`
|
|
1021
1016
|
|
|
1022
1017
|
### Returns
|
|
1023
1018
|
|
|
@@ -1026,28 +1021,28 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
1026
1021
|
## Call Signature
|
|
1027
1022
|
|
|
1028
1023
|
```ts
|
|
1029
|
-
function isFalsy<T>(value
|
|
1024
|
+
function isFalsy<T>(value): value is Extract<T, "">;
|
|
1030
1025
|
```
|
|
1031
1026
|
|
|
1032
1027
|
Type guard that checks whether a value is falsy (0, null, undefined, false, '', or 0n).
|
|
1033
1028
|
|
|
1034
1029
|
### Type Parameters
|
|
1035
1030
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1031
|
+
### T
|
|
1032
|
+
|
|
1033
|
+
`T` *extends* `string`
|
|
1039
1034
|
|
|
1040
1035
|
### Parameters
|
|
1041
1036
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1037
|
+
### value
|
|
1038
|
+
|
|
1039
|
+
`T`
|
|
1045
1040
|
|
|
1046
1041
|
### Returns
|
|
1047
1042
|
|
|
1048
1043
|
`value is Extract<T, "">`
|
|
1049
1044
|
|
|
1050
|
-
|
|
1045
|
+
### <a id="isFile"></a>isFile
|
|
1051
1046
|
|
|
1052
1047
|
[**@xylabs/typeof**](#../README)
|
|
1053
1048
|
|
|
@@ -1056,16 +1051,16 @@ Type guard that checks whether a value is falsy (0, null, undefined, false, '',
|
|
|
1056
1051
|
## Call Signature
|
|
1057
1052
|
|
|
1058
1053
|
```ts
|
|
1059
|
-
function isFile(value
|
|
1054
|
+
function isFile(value): value is File;
|
|
1060
1055
|
```
|
|
1061
1056
|
|
|
1062
1057
|
Type guard that checks whether a value is a File instance.
|
|
1063
1058
|
|
|
1064
1059
|
### Parameters
|
|
1065
1060
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1061
|
+
### value
|
|
1062
|
+
|
|
1063
|
+
`unknown`
|
|
1069
1064
|
|
|
1070
1065
|
### Returns
|
|
1071
1066
|
|
|
@@ -1074,28 +1069,28 @@ Type guard that checks whether a value is a File instance.
|
|
|
1074
1069
|
## Call Signature
|
|
1075
1070
|
|
|
1076
1071
|
```ts
|
|
1077
|
-
function isFile<T>(value
|
|
1072
|
+
function isFile<T>(value): value is Extract<T, File>;
|
|
1078
1073
|
```
|
|
1079
1074
|
|
|
1080
1075
|
Type guard that checks whether a value is a File instance.
|
|
1081
1076
|
|
|
1082
1077
|
### Type Parameters
|
|
1083
1078
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1079
|
+
### T
|
|
1080
|
+
|
|
1081
|
+
`T` *extends* `File`
|
|
1087
1082
|
|
|
1088
1083
|
### Parameters
|
|
1089
1084
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1085
|
+
### value
|
|
1086
|
+
|
|
1087
|
+
`T`
|
|
1093
1088
|
|
|
1094
1089
|
### Returns
|
|
1095
1090
|
|
|
1096
1091
|
`value is Extract<T, File>`
|
|
1097
1092
|
|
|
1098
|
-
|
|
1093
|
+
### <a id="isFunction"></a>isFunction
|
|
1099
1094
|
|
|
1100
1095
|
[**@xylabs/typeof**](#../README)
|
|
1101
1096
|
|
|
@@ -1104,16 +1099,16 @@ Type guard that checks whether a value is a File instance.
|
|
|
1104
1099
|
## Call Signature
|
|
1105
1100
|
|
|
1106
1101
|
```ts
|
|
1107
|
-
function isFunction(value
|
|
1102
|
+
function isFunction(value): value is AnyFunction;
|
|
1108
1103
|
```
|
|
1109
1104
|
|
|
1110
1105
|
Type guard that checks whether a value is a function.
|
|
1111
1106
|
|
|
1112
1107
|
### Parameters
|
|
1113
1108
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1109
|
+
### value
|
|
1110
|
+
|
|
1111
|
+
`unknown`
|
|
1117
1112
|
|
|
1118
1113
|
### Returns
|
|
1119
1114
|
|
|
@@ -1122,28 +1117,28 @@ Type guard that checks whether a value is a function.
|
|
|
1122
1117
|
## Call Signature
|
|
1123
1118
|
|
|
1124
1119
|
```ts
|
|
1125
|
-
function isFunction<T>(value
|
|
1120
|
+
function isFunction<T>(value): value is Extract<T, AnyFunction>;
|
|
1126
1121
|
```
|
|
1127
1122
|
|
|
1128
1123
|
Type guard that checks whether a value is a function.
|
|
1129
1124
|
|
|
1130
1125
|
### Type Parameters
|
|
1131
1126
|
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1127
|
+
### T
|
|
1128
|
+
|
|
1129
|
+
`T` *extends* [`AnyFunction`](#../type-aliases/AnyFunction)
|
|
1135
1130
|
|
|
1136
1131
|
### Parameters
|
|
1137
1132
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1133
|
+
### value
|
|
1134
|
+
|
|
1135
|
+
`T`
|
|
1141
1136
|
|
|
1142
1137
|
### Returns
|
|
1143
1138
|
|
|
1144
1139
|
`value is Extract<T, AnyFunction>`
|
|
1145
1140
|
|
|
1146
|
-
|
|
1141
|
+
### <a id="isMap"></a>isMap
|
|
1147
1142
|
|
|
1148
1143
|
[**@xylabs/typeof**](#../README)
|
|
1149
1144
|
|
|
@@ -1152,16 +1147,16 @@ Type guard that checks whether a value is a function.
|
|
|
1152
1147
|
## Call Signature
|
|
1153
1148
|
|
|
1154
1149
|
```ts
|
|
1155
|
-
function isMap(value
|
|
1150
|
+
function isMap(value): value is Map<unknown, unknown>;
|
|
1156
1151
|
```
|
|
1157
1152
|
|
|
1158
1153
|
Type guard that checks whether a value is a Map instance.
|
|
1159
1154
|
|
|
1160
1155
|
### Parameters
|
|
1161
1156
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1157
|
+
### value
|
|
1158
|
+
|
|
1159
|
+
`unknown`
|
|
1165
1160
|
|
|
1166
1161
|
### Returns
|
|
1167
1162
|
|
|
@@ -1170,30 +1165,36 @@ Type guard that checks whether a value is a Map instance.
|
|
|
1170
1165
|
## Call Signature
|
|
1171
1166
|
|
|
1172
1167
|
```ts
|
|
1173
|
-
function isMap<K, V, T>(value
|
|
1168
|
+
function isMap<K, V, T>(value): value is Extract<T, Map<K, V>>;
|
|
1174
1169
|
```
|
|
1175
1170
|
|
|
1176
1171
|
Type guard that checks whether a value is a Map instance.
|
|
1177
1172
|
|
|
1178
1173
|
### Type Parameters
|
|
1179
1174
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1175
|
+
### K
|
|
1176
|
+
|
|
1177
|
+
`K`
|
|
1178
|
+
|
|
1179
|
+
### V
|
|
1180
|
+
|
|
1181
|
+
`V`
|
|
1182
|
+
|
|
1183
|
+
### T
|
|
1184
|
+
|
|
1185
|
+
`T` *extends* `Map`\<`K`, `V`\>
|
|
1185
1186
|
|
|
1186
1187
|
### Parameters
|
|
1187
1188
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1189
|
+
### value
|
|
1190
|
+
|
|
1191
|
+
`T`
|
|
1191
1192
|
|
|
1192
1193
|
### Returns
|
|
1193
1194
|
|
|
1194
1195
|
`value is Extract<T, Map<K, V>>`
|
|
1195
1196
|
|
|
1196
|
-
|
|
1197
|
+
### <a id="isNull"></a>isNull
|
|
1197
1198
|
|
|
1198
1199
|
[**@xylabs/typeof**](#../README)
|
|
1199
1200
|
|
|
@@ -1202,16 +1203,16 @@ Type guard that checks whether a value is a Map instance.
|
|
|
1202
1203
|
## Call Signature
|
|
1203
1204
|
|
|
1204
1205
|
```ts
|
|
1205
|
-
function isNull(value
|
|
1206
|
+
function isNull(value): value is null;
|
|
1206
1207
|
```
|
|
1207
1208
|
|
|
1208
1209
|
Type guard that checks whether a value is null.
|
|
1209
1210
|
|
|
1210
1211
|
### Parameters
|
|
1211
1212
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1213
|
+
### value
|
|
1214
|
+
|
|
1215
|
+
`unknown`
|
|
1215
1216
|
|
|
1216
1217
|
### Returns
|
|
1217
1218
|
|
|
@@ -1220,28 +1221,28 @@ Type guard that checks whether a value is null.
|
|
|
1220
1221
|
## Call Signature
|
|
1221
1222
|
|
|
1222
1223
|
```ts
|
|
1223
|
-
function isNull<T>(value
|
|
1224
|
+
function isNull<T>(value): value is Extract<T, null>;
|
|
1224
1225
|
```
|
|
1225
1226
|
|
|
1226
1227
|
Type guard that checks whether a value is null.
|
|
1227
1228
|
|
|
1228
1229
|
### Type Parameters
|
|
1229
1230
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1231
|
+
### T
|
|
1232
|
+
|
|
1233
|
+
`T`
|
|
1233
1234
|
|
|
1234
1235
|
### Parameters
|
|
1235
1236
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1237
|
+
### value
|
|
1238
|
+
|
|
1239
|
+
`T`
|
|
1239
1240
|
|
|
1240
1241
|
### Returns
|
|
1241
1242
|
|
|
1242
1243
|
`value is Extract<T, null>`
|
|
1243
1244
|
|
|
1244
|
-
|
|
1245
|
+
### <a id="isNumber"></a>isNumber
|
|
1245
1246
|
|
|
1246
1247
|
[**@xylabs/typeof**](#../README)
|
|
1247
1248
|
|
|
@@ -1250,16 +1251,16 @@ Type guard that checks whether a value is null.
|
|
|
1250
1251
|
## Call Signature
|
|
1251
1252
|
|
|
1252
1253
|
```ts
|
|
1253
|
-
function isNumber(value
|
|
1254
|
+
function isNumber(value): value is number;
|
|
1254
1255
|
```
|
|
1255
1256
|
|
|
1256
1257
|
Type guard that checks whether a value is a number.
|
|
1257
1258
|
|
|
1258
1259
|
### Parameters
|
|
1259
1260
|
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1261
|
+
### value
|
|
1262
|
+
|
|
1263
|
+
`unknown`
|
|
1263
1264
|
|
|
1264
1265
|
### Returns
|
|
1265
1266
|
|
|
@@ -1268,28 +1269,28 @@ Type guard that checks whether a value is a number.
|
|
|
1268
1269
|
## Call Signature
|
|
1269
1270
|
|
|
1270
1271
|
```ts
|
|
1271
|
-
function isNumber<T>(value
|
|
1272
|
+
function isNumber<T>(value): value is Extract<T, number>;
|
|
1272
1273
|
```
|
|
1273
1274
|
|
|
1274
1275
|
Type guard that checks whether a value is a number.
|
|
1275
1276
|
|
|
1276
1277
|
### Type Parameters
|
|
1277
1278
|
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1279
|
+
### T
|
|
1280
|
+
|
|
1281
|
+
`T` *extends* `number`
|
|
1281
1282
|
|
|
1282
1283
|
### Parameters
|
|
1283
1284
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1285
|
+
### value
|
|
1286
|
+
|
|
1287
|
+
`T`
|
|
1287
1288
|
|
|
1288
1289
|
### Returns
|
|
1289
1290
|
|
|
1290
1291
|
`value is Extract<T, number>`
|
|
1291
1292
|
|
|
1292
|
-
|
|
1293
|
+
### <a id="isObject"></a>isObject
|
|
1293
1294
|
|
|
1294
1295
|
[**@xylabs/typeof**](#../README)
|
|
1295
1296
|
|
|
@@ -1298,16 +1299,16 @@ Type guard that checks whether a value is a number.
|
|
|
1298
1299
|
## Call Signature
|
|
1299
1300
|
|
|
1300
1301
|
```ts
|
|
1301
|
-
function isObject(value
|
|
1302
|
+
function isObject(value): value is object;
|
|
1302
1303
|
```
|
|
1303
1304
|
|
|
1304
1305
|
Type guard that checks whether a value is a plain object (not null and not an array).
|
|
1305
1306
|
|
|
1306
1307
|
### Parameters
|
|
1307
1308
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1309
|
+
### value
|
|
1310
|
+
|
|
1311
|
+
`unknown`
|
|
1311
1312
|
|
|
1312
1313
|
### Returns
|
|
1313
1314
|
|
|
@@ -1316,28 +1317,28 @@ Type guard that checks whether a value is a plain object (not null and not an ar
|
|
|
1316
1317
|
## Call Signature
|
|
1317
1318
|
|
|
1318
1319
|
```ts
|
|
1319
|
-
function isObject<T>(value
|
|
1320
|
+
function isObject<T>(value): value is Extract<T, object>;
|
|
1320
1321
|
```
|
|
1321
1322
|
|
|
1322
1323
|
Type guard that checks whether a value is a plain object (not null and not an array).
|
|
1323
1324
|
|
|
1324
1325
|
### Type Parameters
|
|
1325
1326
|
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
### T
|
|
1328
|
+
|
|
1329
|
+
`T` *extends* `object`
|
|
1329
1330
|
|
|
1330
1331
|
### Parameters
|
|
1331
1332
|
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1333
|
+
### value
|
|
1334
|
+
|
|
1335
|
+
`T`
|
|
1335
1336
|
|
|
1336
1337
|
### Returns
|
|
1337
1338
|
|
|
1338
1339
|
`value is Extract<T, object>`
|
|
1339
1340
|
|
|
1340
|
-
|
|
1341
|
+
### <a id="isPopulatedArray"></a>isPopulatedArray
|
|
1341
1342
|
|
|
1342
1343
|
[**@xylabs/typeof**](#../README)
|
|
1343
1344
|
|
|
@@ -1346,16 +1347,16 @@ Type guard that checks whether a value is a plain object (not null and not an ar
|
|
|
1346
1347
|
## Call Signature
|
|
1347
1348
|
|
|
1348
1349
|
```ts
|
|
1349
|
-
function isPopulatedArray(value
|
|
1350
|
+
function isPopulatedArray(value): value is readonly unknown[];
|
|
1350
1351
|
```
|
|
1351
1352
|
|
|
1352
1353
|
Type guard that checks whether a value is a non-empty array.
|
|
1353
1354
|
|
|
1354
1355
|
### Parameters
|
|
1355
1356
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1357
|
+
### value
|
|
1358
|
+
|
|
1359
|
+
`unknown`
|
|
1359
1360
|
|
|
1360
1361
|
### Returns
|
|
1361
1362
|
|
|
@@ -1364,28 +1365,28 @@ Type guard that checks whether a value is a non-empty array.
|
|
|
1364
1365
|
## Call Signature
|
|
1365
1366
|
|
|
1366
1367
|
```ts
|
|
1367
|
-
function isPopulatedArray<T>(value
|
|
1368
|
+
function isPopulatedArray<T>(value): value is Extract<T, readonly unknown[]>;
|
|
1368
1369
|
```
|
|
1369
1370
|
|
|
1370
1371
|
Type guard that checks whether a value is a non-empty array.
|
|
1371
1372
|
|
|
1372
1373
|
### Type Parameters
|
|
1373
1374
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1375
|
+
### T
|
|
1376
|
+
|
|
1377
|
+
`T` *extends* `unknown`[]
|
|
1377
1378
|
|
|
1378
1379
|
### Parameters
|
|
1379
1380
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1381
|
+
### value
|
|
1382
|
+
|
|
1383
|
+
`T`
|
|
1383
1384
|
|
|
1384
1385
|
### Returns
|
|
1385
1386
|
|
|
1386
1387
|
`value is Extract<T, readonly unknown[]>`
|
|
1387
1388
|
|
|
1388
|
-
|
|
1389
|
+
### <a id="isPromise"></a>isPromise
|
|
1389
1390
|
|
|
1390
1391
|
[**@xylabs/typeof**](#../README)
|
|
1391
1392
|
|
|
@@ -1394,16 +1395,16 @@ Type guard that checks whether a value is a non-empty array.
|
|
|
1394
1395
|
## Call Signature
|
|
1395
1396
|
|
|
1396
1397
|
```ts
|
|
1397
|
-
function isPromise(value
|
|
1398
|
+
function isPromise(value): value is Promise<unknown>;
|
|
1398
1399
|
```
|
|
1399
1400
|
|
|
1400
1401
|
Type guard that checks whether a value is a Promise instance.
|
|
1401
1402
|
|
|
1402
1403
|
### Parameters
|
|
1403
1404
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
### value
|
|
1406
|
+
|
|
1407
|
+
`unknown`
|
|
1407
1408
|
|
|
1408
1409
|
### Returns
|
|
1409
1410
|
|
|
@@ -1412,28 +1413,28 @@ Type guard that checks whether a value is a Promise instance.
|
|
|
1412
1413
|
## Call Signature
|
|
1413
1414
|
|
|
1414
1415
|
```ts
|
|
1415
|
-
function isPromise<T>(value
|
|
1416
|
+
function isPromise<T>(value): value is Extract<T, Promise<unknown>>;
|
|
1416
1417
|
```
|
|
1417
1418
|
|
|
1418
1419
|
Type guard that checks whether a value is a Promise instance.
|
|
1419
1420
|
|
|
1420
1421
|
### Type Parameters
|
|
1421
1422
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1423
|
+
### T
|
|
1424
|
+
|
|
1425
|
+
`T`
|
|
1425
1426
|
|
|
1426
1427
|
### Parameters
|
|
1427
1428
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1429
|
+
### value
|
|
1430
|
+
|
|
1431
|
+
`T`
|
|
1431
1432
|
|
|
1432
1433
|
### Returns
|
|
1433
1434
|
|
|
1434
1435
|
`value is Extract<T, Promise<unknown>>`
|
|
1435
1436
|
|
|
1436
|
-
|
|
1437
|
+
### <a id="isPromiseLike"></a>isPromiseLike
|
|
1437
1438
|
|
|
1438
1439
|
[**@xylabs/typeof**](#../README)
|
|
1439
1440
|
|
|
@@ -1442,16 +1443,16 @@ Type guard that checks whether a value is a Promise instance.
|
|
|
1442
1443
|
## Call Signature
|
|
1443
1444
|
|
|
1444
1445
|
```ts
|
|
1445
|
-
function isPromiseLike(value
|
|
1446
|
+
function isPromiseLike(value): value is Promise<unknown>;
|
|
1446
1447
|
```
|
|
1447
1448
|
|
|
1448
1449
|
Type guard that checks whether a value is promise-like (has a `then` method).
|
|
1449
1450
|
|
|
1450
1451
|
### Parameters
|
|
1451
1452
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1453
|
+
### value
|
|
1454
|
+
|
|
1455
|
+
`unknown`
|
|
1455
1456
|
|
|
1456
1457
|
### Returns
|
|
1457
1458
|
|
|
@@ -1460,28 +1461,28 @@ Type guard that checks whether a value is promise-like (has a `then` method).
|
|
|
1460
1461
|
## Call Signature
|
|
1461
1462
|
|
|
1462
1463
|
```ts
|
|
1463
|
-
function isPromiseLike<T>(value
|
|
1464
|
+
function isPromiseLike<T>(value): value is Extract<T, Promise<unknown>>;
|
|
1464
1465
|
```
|
|
1465
1466
|
|
|
1466
1467
|
Type guard that checks whether a value is promise-like (has a `then` method).
|
|
1467
1468
|
|
|
1468
1469
|
### Type Parameters
|
|
1469
1470
|
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1471
|
+
### T
|
|
1472
|
+
|
|
1473
|
+
`T`
|
|
1473
1474
|
|
|
1474
1475
|
### Parameters
|
|
1475
1476
|
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1477
|
+
### value
|
|
1478
|
+
|
|
1479
|
+
`T`
|
|
1479
1480
|
|
|
1480
1481
|
### Returns
|
|
1481
1482
|
|
|
1482
1483
|
`value is Extract<T, Promise<unknown>>`
|
|
1483
1484
|
|
|
1484
|
-
|
|
1485
|
+
### <a id="isRegExp"></a>isRegExp
|
|
1485
1486
|
|
|
1486
1487
|
[**@xylabs/typeof**](#../README)
|
|
1487
1488
|
|
|
@@ -1490,16 +1491,16 @@ Type guard that checks whether a value is promise-like (has a `then` method).
|
|
|
1490
1491
|
## Call Signature
|
|
1491
1492
|
|
|
1492
1493
|
```ts
|
|
1493
|
-
function isRegExp(value
|
|
1494
|
+
function isRegExp(value): value is RegExp;
|
|
1494
1495
|
```
|
|
1495
1496
|
|
|
1496
1497
|
Type guard that checks whether a value is a RegExp instance.
|
|
1497
1498
|
|
|
1498
1499
|
### Parameters
|
|
1499
1500
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1501
|
+
### value
|
|
1502
|
+
|
|
1503
|
+
`unknown`
|
|
1503
1504
|
|
|
1504
1505
|
### Returns
|
|
1505
1506
|
|
|
@@ -1508,28 +1509,28 @@ Type guard that checks whether a value is a RegExp instance.
|
|
|
1508
1509
|
## Call Signature
|
|
1509
1510
|
|
|
1510
1511
|
```ts
|
|
1511
|
-
function isRegExp<T>(value
|
|
1512
|
+
function isRegExp<T>(value): value is Extract<T, RegExp>;
|
|
1512
1513
|
```
|
|
1513
1514
|
|
|
1514
1515
|
Type guard that checks whether a value is a RegExp instance.
|
|
1515
1516
|
|
|
1516
1517
|
### Type Parameters
|
|
1517
1518
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1519
|
+
### T
|
|
1520
|
+
|
|
1521
|
+
`T` *extends* `RegExp`
|
|
1521
1522
|
|
|
1522
1523
|
### Parameters
|
|
1523
1524
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1525
|
+
### value
|
|
1526
|
+
|
|
1527
|
+
`T`
|
|
1527
1528
|
|
|
1528
1529
|
### Returns
|
|
1529
1530
|
|
|
1530
1531
|
`value is Extract<T, RegExp>`
|
|
1531
1532
|
|
|
1532
|
-
|
|
1533
|
+
### <a id="isSet"></a>isSet
|
|
1533
1534
|
|
|
1534
1535
|
[**@xylabs/typeof**](#../README)
|
|
1535
1536
|
|
|
@@ -1538,16 +1539,16 @@ Type guard that checks whether a value is a RegExp instance.
|
|
|
1538
1539
|
## Call Signature
|
|
1539
1540
|
|
|
1540
1541
|
```ts
|
|
1541
|
-
function isSet(value
|
|
1542
|
+
function isSet(value): value is Set<unknown>;
|
|
1542
1543
|
```
|
|
1543
1544
|
|
|
1544
1545
|
Type guard that checks whether a value is a Set instance.
|
|
1545
1546
|
|
|
1546
1547
|
### Parameters
|
|
1547
1548
|
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1549
|
+
### value
|
|
1550
|
+
|
|
1551
|
+
`unknown`
|
|
1551
1552
|
|
|
1552
1553
|
### Returns
|
|
1553
1554
|
|
|
@@ -1556,28 +1557,28 @@ Type guard that checks whether a value is a Set instance.
|
|
|
1556
1557
|
## Call Signature
|
|
1557
1558
|
|
|
1558
1559
|
```ts
|
|
1559
|
-
function isSet<T>(value
|
|
1560
|
+
function isSet<T>(value): value is Extract<T, Set<unknown>>;
|
|
1560
1561
|
```
|
|
1561
1562
|
|
|
1562
1563
|
Type guard that checks whether a value is a Set instance.
|
|
1563
1564
|
|
|
1564
1565
|
### Type Parameters
|
|
1565
1566
|
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1567
|
+
### T
|
|
1568
|
+
|
|
1569
|
+
`T` *extends* `Set`\<`unknown`\>
|
|
1569
1570
|
|
|
1570
1571
|
### Parameters
|
|
1571
1572
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1573
|
+
### value
|
|
1574
|
+
|
|
1575
|
+
`unknown`
|
|
1575
1576
|
|
|
1576
1577
|
### Returns
|
|
1577
1578
|
|
|
1578
1579
|
`value is Extract<T, Set<unknown>>`
|
|
1579
1580
|
|
|
1580
|
-
|
|
1581
|
+
### <a id="isString"></a>isString
|
|
1581
1582
|
|
|
1582
1583
|
[**@xylabs/typeof**](#../README)
|
|
1583
1584
|
|
|
@@ -1586,16 +1587,16 @@ Type guard that checks whether a value is a Set instance.
|
|
|
1586
1587
|
## Call Signature
|
|
1587
1588
|
|
|
1588
1589
|
```ts
|
|
1589
|
-
function isString(value
|
|
1590
|
+
function isString(value): value is string;
|
|
1590
1591
|
```
|
|
1591
1592
|
|
|
1592
1593
|
Type guard that checks whether a value is a string.
|
|
1593
1594
|
|
|
1594
1595
|
### Parameters
|
|
1595
1596
|
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1597
|
+
### value
|
|
1598
|
+
|
|
1599
|
+
`unknown`
|
|
1599
1600
|
|
|
1600
1601
|
### Returns
|
|
1601
1602
|
|
|
@@ -1604,28 +1605,28 @@ Type guard that checks whether a value is a string.
|
|
|
1604
1605
|
## Call Signature
|
|
1605
1606
|
|
|
1606
1607
|
```ts
|
|
1607
|
-
function isString<T>(value
|
|
1608
|
+
function isString<T>(value): value is Extract<T, string>;
|
|
1608
1609
|
```
|
|
1609
1610
|
|
|
1610
1611
|
Type guard that checks whether a value is a string.
|
|
1611
1612
|
|
|
1612
1613
|
### Type Parameters
|
|
1613
1614
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1615
|
+
### T
|
|
1616
|
+
|
|
1617
|
+
`T` *extends* `string`
|
|
1617
1618
|
|
|
1618
1619
|
### Parameters
|
|
1619
1620
|
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1621
|
+
### value
|
|
1622
|
+
|
|
1623
|
+
`T`
|
|
1623
1624
|
|
|
1624
1625
|
### Returns
|
|
1625
1626
|
|
|
1626
1627
|
`value is Extract<T, string>`
|
|
1627
1628
|
|
|
1628
|
-
|
|
1629
|
+
### <a id="isSymbol"></a>isSymbol
|
|
1629
1630
|
|
|
1630
1631
|
[**@xylabs/typeof**](#../README)
|
|
1631
1632
|
|
|
@@ -1634,16 +1635,16 @@ Type guard that checks whether a value is a string.
|
|
|
1634
1635
|
## Call Signature
|
|
1635
1636
|
|
|
1636
1637
|
```ts
|
|
1637
|
-
function isSymbol(value
|
|
1638
|
+
function isSymbol(value): value is symbol;
|
|
1638
1639
|
```
|
|
1639
1640
|
|
|
1640
1641
|
Type guard that checks whether a value is a symbol.
|
|
1641
1642
|
|
|
1642
1643
|
### Parameters
|
|
1643
1644
|
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1645
|
+
### value
|
|
1646
|
+
|
|
1647
|
+
`unknown`
|
|
1647
1648
|
|
|
1648
1649
|
### Returns
|
|
1649
1650
|
|
|
@@ -1652,28 +1653,28 @@ Type guard that checks whether a value is a symbol.
|
|
|
1652
1653
|
## Call Signature
|
|
1653
1654
|
|
|
1654
1655
|
```ts
|
|
1655
|
-
function isSymbol<T>(value
|
|
1656
|
+
function isSymbol<T>(value): value is Extract<T, symbol>;
|
|
1656
1657
|
```
|
|
1657
1658
|
|
|
1658
1659
|
Type guard that checks whether a value is a symbol.
|
|
1659
1660
|
|
|
1660
1661
|
### Type Parameters
|
|
1661
1662
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1663
|
+
### T
|
|
1664
|
+
|
|
1665
|
+
`T` *extends* `symbol`
|
|
1665
1666
|
|
|
1666
1667
|
### Parameters
|
|
1667
1668
|
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1669
|
+
### value
|
|
1670
|
+
|
|
1671
|
+
`T`
|
|
1671
1672
|
|
|
1672
1673
|
### Returns
|
|
1673
1674
|
|
|
1674
1675
|
`value is Extract<T, symbol>`
|
|
1675
1676
|
|
|
1676
|
-
|
|
1677
|
+
### <a id="isTruthy"></a>isTruthy
|
|
1677
1678
|
|
|
1678
1679
|
[**@xylabs/typeof**](#../README)
|
|
1679
1680
|
|
|
@@ -1682,22 +1683,22 @@ Type guard that checks whether a value is a symbol.
|
|
|
1682
1683
|
## Call Signature
|
|
1683
1684
|
|
|
1684
1685
|
```ts
|
|
1685
|
-
function isTruthy<T>(value
|
|
1686
|
+
function isTruthy<T>(value): value is Exclude<T, false | "" | 0 | 0n | null | undefined>;
|
|
1686
1687
|
```
|
|
1687
1688
|
|
|
1688
1689
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1689
1690
|
|
|
1690
1691
|
### Type Parameters
|
|
1691
1692
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1693
|
+
### T
|
|
1694
|
+
|
|
1695
|
+
`T`
|
|
1695
1696
|
|
|
1696
1697
|
### Parameters
|
|
1697
1698
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1699
|
+
### value
|
|
1700
|
+
|
|
1701
|
+
`T`
|
|
1701
1702
|
|
|
1702
1703
|
### Returns
|
|
1703
1704
|
|
|
@@ -1706,22 +1707,22 @@ value is Exclude\<T, false \| "" \| 0 \| 0n \| null \| undefined\>
|
|
|
1706
1707
|
## Call Signature
|
|
1707
1708
|
|
|
1708
1709
|
```ts
|
|
1709
|
-
function isTruthy<T>(value
|
|
1710
|
+
function isTruthy<T>(value): value is Extract<T, true>;
|
|
1710
1711
|
```
|
|
1711
1712
|
|
|
1712
1713
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1713
1714
|
|
|
1714
1715
|
### Type Parameters
|
|
1715
1716
|
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1717
|
+
### T
|
|
1718
|
+
|
|
1719
|
+
`T` *extends* `boolean`
|
|
1719
1720
|
|
|
1720
1721
|
### Parameters
|
|
1721
1722
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1723
|
+
### value
|
|
1724
|
+
|
|
1725
|
+
`T`
|
|
1725
1726
|
|
|
1726
1727
|
### Returns
|
|
1727
1728
|
|
|
@@ -1730,22 +1731,22 @@ Type guard that checks whether a value is truthy (not 0, null, undefined, false,
|
|
|
1730
1731
|
## Call Signature
|
|
1731
1732
|
|
|
1732
1733
|
```ts
|
|
1733
|
-
function isTruthy<T>(value
|
|
1734
|
+
function isTruthy<T>(value): value is Extract<T, number>;
|
|
1734
1735
|
```
|
|
1735
1736
|
|
|
1736
1737
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1737
1738
|
|
|
1738
1739
|
### Type Parameters
|
|
1739
1740
|
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1741
|
+
### T
|
|
1742
|
+
|
|
1743
|
+
`T` *extends* `number`
|
|
1743
1744
|
|
|
1744
1745
|
### Parameters
|
|
1745
1746
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1747
|
+
### value
|
|
1748
|
+
|
|
1749
|
+
`T`
|
|
1749
1750
|
|
|
1750
1751
|
### Returns
|
|
1751
1752
|
|
|
@@ -1754,22 +1755,22 @@ Type guard that checks whether a value is truthy (not 0, null, undefined, false,
|
|
|
1754
1755
|
## Call Signature
|
|
1755
1756
|
|
|
1756
1757
|
```ts
|
|
1757
|
-
function isTruthy<T>(value
|
|
1758
|
+
function isTruthy<T>(value): value is Extract<T, bigint>;
|
|
1758
1759
|
```
|
|
1759
1760
|
|
|
1760
1761
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1761
1762
|
|
|
1762
1763
|
### Type Parameters
|
|
1763
1764
|
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1765
|
+
### T
|
|
1766
|
+
|
|
1767
|
+
`T` *extends* `bigint`
|
|
1767
1768
|
|
|
1768
1769
|
### Parameters
|
|
1769
1770
|
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1771
|
+
### value
|
|
1772
|
+
|
|
1773
|
+
`T`
|
|
1773
1774
|
|
|
1774
1775
|
### Returns
|
|
1775
1776
|
|
|
@@ -1778,22 +1779,22 @@ Type guard that checks whether a value is truthy (not 0, null, undefined, false,
|
|
|
1778
1779
|
## Call Signature
|
|
1779
1780
|
|
|
1780
1781
|
```ts
|
|
1781
|
-
function isTruthy<T>(value
|
|
1782
|
+
function isTruthy<T>(value): value is Extract<T, null>;
|
|
1782
1783
|
```
|
|
1783
1784
|
|
|
1784
1785
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1785
1786
|
|
|
1786
1787
|
### Type Parameters
|
|
1787
1788
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1789
|
+
### T
|
|
1790
|
+
|
|
1791
|
+
`T` *extends* `null`
|
|
1791
1792
|
|
|
1792
1793
|
### Parameters
|
|
1793
1794
|
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1795
|
+
### value
|
|
1796
|
+
|
|
1797
|
+
`T`
|
|
1797
1798
|
|
|
1798
1799
|
### Returns
|
|
1799
1800
|
|
|
@@ -1802,22 +1803,22 @@ Type guard that checks whether a value is truthy (not 0, null, undefined, false,
|
|
|
1802
1803
|
## Call Signature
|
|
1803
1804
|
|
|
1804
1805
|
```ts
|
|
1805
|
-
function isTruthy<T>(value
|
|
1806
|
+
function isTruthy<T>(value): value is Extract<T, undefined>;
|
|
1806
1807
|
```
|
|
1807
1808
|
|
|
1808
1809
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1809
1810
|
|
|
1810
1811
|
### Type Parameters
|
|
1811
1812
|
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1813
|
+
### T
|
|
1814
|
+
|
|
1815
|
+
`T` *extends* `undefined`
|
|
1815
1816
|
|
|
1816
1817
|
### Parameters
|
|
1817
1818
|
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1819
|
+
### value
|
|
1820
|
+
|
|
1821
|
+
`T`
|
|
1821
1822
|
|
|
1822
1823
|
### Returns
|
|
1823
1824
|
|
|
@@ -1826,45 +1827,52 @@ Type guard that checks whether a value is truthy (not 0, null, undefined, false,
|
|
|
1826
1827
|
## Call Signature
|
|
1827
1828
|
|
|
1828
1829
|
```ts
|
|
1829
|
-
function isTruthy<T>(value
|
|
1830
|
+
function isTruthy<T>(value): value is Extract<T, string>;
|
|
1830
1831
|
```
|
|
1831
1832
|
|
|
1832
1833
|
Type guard that checks whether a value is truthy (not 0, null, undefined, false, '', or 0n).
|
|
1833
1834
|
|
|
1834
1835
|
### Type Parameters
|
|
1835
1836
|
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1837
|
+
### T
|
|
1838
|
+
|
|
1839
|
+
`T` *extends* `string`
|
|
1839
1840
|
|
|
1840
1841
|
### Parameters
|
|
1841
1842
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1843
|
+
### value
|
|
1844
|
+
|
|
1845
|
+
`T`
|
|
1845
1846
|
|
|
1846
1847
|
### Returns
|
|
1847
1848
|
|
|
1848
1849
|
`value is Extract<T, string>`
|
|
1849
1850
|
|
|
1850
|
-
|
|
1851
|
+
### <a id="isType"></a>isType
|
|
1851
1852
|
|
|
1852
1853
|
[**@xylabs/typeof**](#../README)
|
|
1853
1854
|
|
|
1854
1855
|
***
|
|
1855
1856
|
|
|
1856
1857
|
```ts
|
|
1857
|
-
function isType(value
|
|
1858
|
+
function isType(value, expectedType): boolean;
|
|
1858
1859
|
```
|
|
1859
1860
|
|
|
1860
1861
|
Checks whether a value matches the expected field type, with correct handling for arrays and nulls.
|
|
1861
1862
|
|
|
1862
1863
|
## Parameters
|
|
1863
1864
|
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1865
|
+
### value
|
|
1866
|
+
|
|
1867
|
+
`unknown`
|
|
1868
|
+
|
|
1869
|
+
The value to check.
|
|
1870
|
+
|
|
1871
|
+
### expectedType
|
|
1872
|
+
|
|
1873
|
+
[`FieldType`](#../type-aliases/FieldType)
|
|
1874
|
+
|
|
1875
|
+
The expected type string.
|
|
1868
1876
|
|
|
1869
1877
|
## Returns
|
|
1870
1878
|
|
|
@@ -1872,23 +1880,25 @@ Checks whether a value matches the expected field type, with correct handling fo
|
|
|
1872
1880
|
|
|
1873
1881
|
True if the value matches the expected type.
|
|
1874
1882
|
|
|
1875
|
-
|
|
1883
|
+
### <a id="isTypedArray"></a>isTypedArray
|
|
1876
1884
|
|
|
1877
1885
|
[**@xylabs/typeof**](#../README)
|
|
1878
1886
|
|
|
1879
1887
|
***
|
|
1880
1888
|
|
|
1881
1889
|
```ts
|
|
1882
|
-
function isTypedArray(value
|
|
1890
|
+
function isTypedArray(value): value is TypedArray;
|
|
1883
1891
|
```
|
|
1884
1892
|
|
|
1885
1893
|
Type guard that checks whether a value is a TypedArray (an array where every element is a TypedValue).
|
|
1886
1894
|
|
|
1887
1895
|
## Parameters
|
|
1888
1896
|
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1897
|
+
### value
|
|
1898
|
+
|
|
1899
|
+
`unknown`
|
|
1900
|
+
|
|
1901
|
+
The value to check.
|
|
1892
1902
|
|
|
1893
1903
|
## Returns
|
|
1894
1904
|
|
|
@@ -1896,23 +1906,25 @@ Type guard that checks whether a value is a TypedArray (an array where every ele
|
|
|
1896
1906
|
|
|
1897
1907
|
True if the value is an array of TypedValue elements.
|
|
1898
1908
|
|
|
1899
|
-
|
|
1909
|
+
### <a id="isTypedKey"></a>isTypedKey
|
|
1900
1910
|
|
|
1901
1911
|
[**@xylabs/typeof**](#../README)
|
|
1902
1912
|
|
|
1903
1913
|
***
|
|
1904
1914
|
|
|
1905
1915
|
```ts
|
|
1906
|
-
function isTypedKey(value
|
|
1916
|
+
function isTypedKey(value): value is string | number | symbol;
|
|
1907
1917
|
```
|
|
1908
1918
|
|
|
1909
1919
|
Type guard that checks whether a value is a valid TypedKey (string, bigint, number, or symbol).
|
|
1910
1920
|
|
|
1911
1921
|
## Parameters
|
|
1912
1922
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1923
|
+
### value
|
|
1924
|
+
|
|
1925
|
+
`unknown`
|
|
1926
|
+
|
|
1927
|
+
The value to check.
|
|
1916
1928
|
|
|
1917
1929
|
## Returns
|
|
1918
1930
|
|
|
@@ -1920,23 +1932,25 @@ value is string \| number \| symbol
|
|
|
1920
1932
|
|
|
1921
1933
|
True if the value is a valid TypedKey.
|
|
1922
1934
|
|
|
1923
|
-
|
|
1935
|
+
### <a id="isTypedObject"></a>isTypedObject
|
|
1924
1936
|
|
|
1925
1937
|
[**@xylabs/typeof**](#../README)
|
|
1926
1938
|
|
|
1927
1939
|
***
|
|
1928
1940
|
|
|
1929
1941
|
```ts
|
|
1930
|
-
function isTypedObject(value
|
|
1942
|
+
function isTypedObject(value): value is TypedObject;
|
|
1931
1943
|
```
|
|
1932
1944
|
|
|
1933
1945
|
Type guard that checks whether a value is a TypedObject (an object with TypedKey keys and TypedValue values).
|
|
1934
1946
|
|
|
1935
1947
|
## Parameters
|
|
1936
1948
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1949
|
+
### value
|
|
1950
|
+
|
|
1951
|
+
`unknown`
|
|
1952
|
+
|
|
1953
|
+
The value to check.
|
|
1940
1954
|
|
|
1941
1955
|
## Returns
|
|
1942
1956
|
|
|
@@ -1944,23 +1958,25 @@ Type guard that checks whether a value is a TypedObject (an object with TypedKey
|
|
|
1944
1958
|
|
|
1945
1959
|
True if the value is a valid TypedObject.
|
|
1946
1960
|
|
|
1947
|
-
|
|
1961
|
+
### <a id="isTypedValue"></a>isTypedValue
|
|
1948
1962
|
|
|
1949
1963
|
[**@xylabs/typeof**](#../README)
|
|
1950
1964
|
|
|
1951
1965
|
***
|
|
1952
1966
|
|
|
1953
1967
|
```ts
|
|
1954
|
-
function isTypedValue(value
|
|
1968
|
+
function isTypedValue(value): value is TypedValue;
|
|
1955
1969
|
```
|
|
1956
1970
|
|
|
1957
1971
|
Type guard that checks whether a value is a valid TypedValue.
|
|
1958
1972
|
|
|
1959
1973
|
## Parameters
|
|
1960
1974
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1975
|
+
### value
|
|
1976
|
+
|
|
1977
|
+
`unknown`
|
|
1978
|
+
|
|
1979
|
+
The value to check.
|
|
1964
1980
|
|
|
1965
1981
|
## Returns
|
|
1966
1982
|
|
|
@@ -1968,7 +1984,7 @@ Type guard that checks whether a value is a valid TypedValue.
|
|
|
1968
1984
|
|
|
1969
1985
|
True if the value is a string, number, boolean, null, TypedObject, or TypedArray.
|
|
1970
1986
|
|
|
1971
|
-
|
|
1987
|
+
### <a id="isUndefined"></a>isUndefined
|
|
1972
1988
|
|
|
1973
1989
|
[**@xylabs/typeof**](#../README)
|
|
1974
1990
|
|
|
@@ -1977,16 +1993,16 @@ True if the value is a string, number, boolean, null, TypedObject, or TypedArray
|
|
|
1977
1993
|
## Call Signature
|
|
1978
1994
|
|
|
1979
1995
|
```ts
|
|
1980
|
-
function isUndefined(value
|
|
1996
|
+
function isUndefined(value): value is undefined;
|
|
1981
1997
|
```
|
|
1982
1998
|
|
|
1983
1999
|
Type guard that checks whether a value is undefined.
|
|
1984
2000
|
|
|
1985
2001
|
### Parameters
|
|
1986
2002
|
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2003
|
+
### value
|
|
2004
|
+
|
|
2005
|
+
`unknown`
|
|
1990
2006
|
|
|
1991
2007
|
### Returns
|
|
1992
2008
|
|
|
@@ -1995,28 +2011,28 @@ Type guard that checks whether a value is undefined.
|
|
|
1995
2011
|
## Call Signature
|
|
1996
2012
|
|
|
1997
2013
|
```ts
|
|
1998
|
-
function isUndefined<T>(value
|
|
2014
|
+
function isUndefined<T>(value): value is Extract<T, undefined>;
|
|
1999
2015
|
```
|
|
2000
2016
|
|
|
2001
2017
|
Type guard that checks whether a value is undefined.
|
|
2002
2018
|
|
|
2003
2019
|
### Type Parameters
|
|
2004
2020
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2021
|
+
### T
|
|
2022
|
+
|
|
2023
|
+
`T`
|
|
2008
2024
|
|
|
2009
2025
|
### Parameters
|
|
2010
2026
|
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2027
|
+
### value
|
|
2028
|
+
|
|
2029
|
+
`T`
|
|
2014
2030
|
|
|
2015
2031
|
### Returns
|
|
2016
2032
|
|
|
2017
2033
|
`value is Extract<T, undefined>`
|
|
2018
2034
|
|
|
2019
|
-
|
|
2035
|
+
### <a id="isUndefinedOrNull"></a>isUndefinedOrNull
|
|
2020
2036
|
|
|
2021
2037
|
[**@xylabs/typeof**](#../README)
|
|
2022
2038
|
|
|
@@ -2025,16 +2041,16 @@ Type guard that checks whether a value is undefined.
|
|
|
2025
2041
|
## Call Signature
|
|
2026
2042
|
|
|
2027
2043
|
```ts
|
|
2028
|
-
function isUndefinedOrNull(value
|
|
2044
|
+
function isUndefinedOrNull(value): value is null | undefined;
|
|
2029
2045
|
```
|
|
2030
2046
|
|
|
2031
2047
|
Type guard that checks whether a value is undefined or null.
|
|
2032
2048
|
|
|
2033
2049
|
### Parameters
|
|
2034
2050
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2051
|
+
### value
|
|
2052
|
+
|
|
2053
|
+
`unknown`
|
|
2038
2054
|
|
|
2039
2055
|
### Returns
|
|
2040
2056
|
|
|
@@ -2043,44 +2059,46 @@ value is null \| undefined
|
|
|
2043
2059
|
## Call Signature
|
|
2044
2060
|
|
|
2045
2061
|
```ts
|
|
2046
|
-
function isUndefinedOrNull<T>(value
|
|
2062
|
+
function isUndefinedOrNull<T>(value): value is Extract<T, null | undefined>;
|
|
2047
2063
|
```
|
|
2048
2064
|
|
|
2049
2065
|
Type guard that checks whether a value is undefined or null.
|
|
2050
2066
|
|
|
2051
2067
|
### Type Parameters
|
|
2052
2068
|
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2069
|
+
### T
|
|
2070
|
+
|
|
2071
|
+
`T`
|
|
2056
2072
|
|
|
2057
2073
|
### Parameters
|
|
2058
2074
|
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2075
|
+
### value
|
|
2076
|
+
|
|
2077
|
+
`T`
|
|
2062
2078
|
|
|
2063
2079
|
### Returns
|
|
2064
2080
|
|
|
2065
2081
|
value is Extract\<T, null \| undefined\>
|
|
2066
2082
|
|
|
2067
|
-
|
|
2083
|
+
### <a id="isValidTypedFieldPair"></a>isValidTypedFieldPair
|
|
2068
2084
|
|
|
2069
2085
|
[**@xylabs/typeof**](#../README)
|
|
2070
2086
|
|
|
2071
2087
|
***
|
|
2072
2088
|
|
|
2073
2089
|
```ts
|
|
2074
|
-
function isValidTypedFieldPair(pair
|
|
2090
|
+
function isValidTypedFieldPair(pair): pair is [key: string | number | symbol, value: TypedValue];
|
|
2075
2091
|
```
|
|
2076
2092
|
|
|
2077
2093
|
Type guard that checks whether a key-value pair has a valid TypedKey and TypedValue.
|
|
2078
2094
|
|
|
2079
2095
|
## Parameters
|
|
2080
2096
|
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2097
|
+
### pair
|
|
2098
|
+
|
|
2099
|
+
\[`unknown`, `unknown`\]
|
|
2100
|
+
|
|
2101
|
+
A tuple of [key, value] to validate.
|
|
2084
2102
|
|
|
2085
2103
|
## Returns
|
|
2086
2104
|
|
|
@@ -2088,7 +2106,7 @@ pair is \[key: string \| number \| symbol, value: TypedValue\]
|
|
|
2088
2106
|
|
|
2089
2107
|
True if the key is a TypedKey and the value is a TypedValue.
|
|
2090
2108
|
|
|
2091
|
-
|
|
2109
|
+
### <a id="isWeakMap"></a>isWeakMap
|
|
2092
2110
|
|
|
2093
2111
|
[**@xylabs/typeof**](#../README)
|
|
2094
2112
|
|
|
@@ -2097,16 +2115,16 @@ True if the key is a TypedKey and the value is a TypedValue.
|
|
|
2097
2115
|
## Call Signature
|
|
2098
2116
|
|
|
2099
2117
|
```ts
|
|
2100
|
-
function isWeakMap(value
|
|
2118
|
+
function isWeakMap(value): value is WeakMap<WeakKey, unknown>;
|
|
2101
2119
|
```
|
|
2102
2120
|
|
|
2103
2121
|
Type guard that checks whether a value is a WeakMap instance.
|
|
2104
2122
|
|
|
2105
2123
|
### Parameters
|
|
2106
2124
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2125
|
+
### value
|
|
2126
|
+
|
|
2127
|
+
`unknown`
|
|
2110
2128
|
|
|
2111
2129
|
### Returns
|
|
2112
2130
|
|
|
@@ -2115,30 +2133,36 @@ Type guard that checks whether a value is a WeakMap instance.
|
|
|
2115
2133
|
## Call Signature
|
|
2116
2134
|
|
|
2117
2135
|
```ts
|
|
2118
|
-
function isWeakMap<K, V, T>(value
|
|
2136
|
+
function isWeakMap<K, V, T>(value): value is Extract<T, WeakMap<K, V>>;
|
|
2119
2137
|
```
|
|
2120
2138
|
|
|
2121
2139
|
Type guard that checks whether a value is a WeakMap instance.
|
|
2122
2140
|
|
|
2123
2141
|
### Type Parameters
|
|
2124
2142
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2143
|
+
### K
|
|
2144
|
+
|
|
2145
|
+
`K` *extends* `WeakKey`
|
|
2146
|
+
|
|
2147
|
+
### V
|
|
2148
|
+
|
|
2149
|
+
`V`
|
|
2150
|
+
|
|
2151
|
+
### T
|
|
2152
|
+
|
|
2153
|
+
`T` *extends* `WeakMap`\<`K`, `V`\>
|
|
2130
2154
|
|
|
2131
2155
|
### Parameters
|
|
2132
2156
|
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2157
|
+
### value
|
|
2158
|
+
|
|
2159
|
+
`T`
|
|
2136
2160
|
|
|
2137
2161
|
### Returns
|
|
2138
2162
|
|
|
2139
2163
|
`value is Extract<T, WeakMap<K, V>>`
|
|
2140
2164
|
|
|
2141
|
-
|
|
2165
|
+
### <a id="isWeakSet"></a>isWeakSet
|
|
2142
2166
|
|
|
2143
2167
|
[**@xylabs/typeof**](#../README)
|
|
2144
2168
|
|
|
@@ -2147,16 +2171,16 @@ Type guard that checks whether a value is a WeakMap instance.
|
|
|
2147
2171
|
## Call Signature
|
|
2148
2172
|
|
|
2149
2173
|
```ts
|
|
2150
|
-
function isWeakSet(value
|
|
2174
|
+
function isWeakSet(value): value is WeakSet<WeakKey>;
|
|
2151
2175
|
```
|
|
2152
2176
|
|
|
2153
2177
|
Type guard that checks whether a value is a WeakSet instance.
|
|
2154
2178
|
|
|
2155
2179
|
### Parameters
|
|
2156
2180
|
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2181
|
+
### value
|
|
2182
|
+
|
|
2183
|
+
`unknown`
|
|
2160
2184
|
|
|
2161
2185
|
### Returns
|
|
2162
2186
|
|
|
@@ -2165,51 +2189,56 @@ Type guard that checks whether a value is a WeakSet instance.
|
|
|
2165
2189
|
## Call Signature
|
|
2166
2190
|
|
|
2167
2191
|
```ts
|
|
2168
|
-
function isWeakSet<K, T>(value
|
|
2192
|
+
function isWeakSet<K, T>(value): value is Extract<T, WeakSet<K>>;
|
|
2169
2193
|
```
|
|
2170
2194
|
|
|
2171
2195
|
Type guard that checks whether a value is a WeakSet instance.
|
|
2172
2196
|
|
|
2173
2197
|
### Type Parameters
|
|
2174
2198
|
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2199
|
+
### K
|
|
2200
|
+
|
|
2201
|
+
`K` *extends* `WeakKey`
|
|
2202
|
+
|
|
2203
|
+
### T
|
|
2204
|
+
|
|
2205
|
+
`T` *extends* `WeakSet`\<`K`\>
|
|
2179
2206
|
|
|
2180
2207
|
### Parameters
|
|
2181
2208
|
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2209
|
+
### value
|
|
2210
|
+
|
|
2211
|
+
`T`
|
|
2185
2212
|
|
|
2186
2213
|
### Returns
|
|
2187
2214
|
|
|
2188
2215
|
`value is Extract<T, WeakSet<K>>`
|
|
2189
2216
|
|
|
2190
|
-
|
|
2217
|
+
### <a id="typeOf"></a>typeOf
|
|
2191
2218
|
|
|
2192
2219
|
[**@xylabs/typeof**](#../README)
|
|
2193
2220
|
|
|
2194
2221
|
***
|
|
2195
2222
|
|
|
2196
2223
|
```ts
|
|
2197
|
-
function typeOf<T>(item
|
|
2224
|
+
function typeOf<T>(item): TypeOfTypes;
|
|
2198
2225
|
```
|
|
2199
2226
|
|
|
2200
2227
|
Extended typeof that distinguishes arrays from objects (unlike native `typeof`).
|
|
2201
2228
|
|
|
2202
2229
|
## Type Parameters
|
|
2203
2230
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2231
|
+
### T
|
|
2232
|
+
|
|
2233
|
+
`T`
|
|
2207
2234
|
|
|
2208
2235
|
## Parameters
|
|
2209
2236
|
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2237
|
+
### item
|
|
2238
|
+
|
|
2239
|
+
`T`
|
|
2240
|
+
|
|
2241
|
+
The value to check.
|
|
2213
2242
|
|
|
2214
2243
|
## Returns
|
|
2215
2244
|
|
|
@@ -2217,7 +2246,7 @@ Extended typeof that distinguishes arrays from objects (unlike native `typeof`).
|
|
|
2217
2246
|
|
|
2218
2247
|
The type of the item as a TypeOfTypes string.
|
|
2219
2248
|
|
|
2220
|
-
|
|
2249
|
+
### <a id="validateType"></a>validateType
|
|
2221
2250
|
|
|
2222
2251
|
[**@xylabs/typeof**](#../README)
|
|
2223
2252
|
|
|
@@ -2225,26 +2254,38 @@ The type of the item as a TypeOfTypes string.
|
|
|
2225
2254
|
|
|
2226
2255
|
```ts
|
|
2227
2256
|
function validateType<T>(
|
|
2228
|
-
typeName
|
|
2229
|
-
value
|
|
2230
|
-
optional
|
|
2257
|
+
typeName,
|
|
2258
|
+
value,
|
|
2259
|
+
optional?): [T | undefined, Error[]];
|
|
2231
2260
|
```
|
|
2232
2261
|
|
|
2233
2262
|
Validates that a value matches the expected type, returning the value and any errors.
|
|
2234
2263
|
|
|
2235
2264
|
## Type Parameters
|
|
2236
2265
|
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2266
|
+
### T
|
|
2267
|
+
|
|
2268
|
+
`T`
|
|
2240
2269
|
|
|
2241
2270
|
## Parameters
|
|
2242
2271
|
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2272
|
+
### typeName
|
|
2273
|
+
|
|
2274
|
+
[`TypeOfTypes`](#../type-aliases/TypeOfTypes)
|
|
2275
|
+
|
|
2276
|
+
The expected type name.
|
|
2277
|
+
|
|
2278
|
+
### value
|
|
2279
|
+
|
|
2280
|
+
`T`
|
|
2281
|
+
|
|
2282
|
+
The value to validate.
|
|
2283
|
+
|
|
2284
|
+
### optional?
|
|
2285
|
+
|
|
2286
|
+
`boolean` = `false`
|
|
2287
|
+
|
|
2288
|
+
If true, undefined values are accepted without error.
|
|
2248
2289
|
|
|
2249
2290
|
## Returns
|
|
2250
2291
|
|
|
@@ -2252,31 +2293,31 @@ Validates that a value matches the expected type, returning the value and any er
|
|
|
2252
2293
|
|
|
2253
2294
|
A tuple of [value or undefined, array of errors].
|
|
2254
2295
|
|
|
2255
|
-
### type-aliases
|
|
2296
|
+
### type-aliases
|
|
2256
2297
|
|
|
2257
|
-
|
|
2298
|
+
### <a id="AnyFunction"></a>AnyFunction
|
|
2258
2299
|
|
|
2259
2300
|
[**@xylabs/typeof**](#../README)
|
|
2260
2301
|
|
|
2261
2302
|
***
|
|
2262
2303
|
|
|
2263
2304
|
```ts
|
|
2264
|
-
type AnyFunction = (...args
|
|
2305
|
+
type AnyFunction = (...args) => unknown;
|
|
2265
2306
|
```
|
|
2266
2307
|
|
|
2267
2308
|
A function type that accepts any arguments and returns unknown.
|
|
2268
2309
|
|
|
2269
2310
|
## Parameters
|
|
2270
2311
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2312
|
+
### args
|
|
2313
|
+
|
|
2314
|
+
...`unknown`[]
|
|
2274
2315
|
|
|
2275
2316
|
## Returns
|
|
2276
2317
|
|
|
2277
2318
|
`unknown`
|
|
2278
2319
|
|
|
2279
|
-
|
|
2320
|
+
### <a id="Brand"></a>Brand
|
|
2280
2321
|
|
|
2281
2322
|
[**@xylabs/typeof**](#../README)
|
|
2282
2323
|
|
|
@@ -2290,12 +2331,15 @@ Creates a branded type by intersecting base type T with brand type B, enabling n
|
|
|
2290
2331
|
|
|
2291
2332
|
## Type Parameters
|
|
2292
2333
|
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2334
|
+
### T
|
|
2335
|
+
|
|
2336
|
+
`T`
|
|
2337
|
+
|
|
2338
|
+
### B
|
|
2339
|
+
|
|
2340
|
+
`B`
|
|
2297
2341
|
|
|
2298
|
-
|
|
2342
|
+
### <a id="FieldType"></a>FieldType
|
|
2299
2343
|
|
|
2300
2344
|
[**@xylabs/typeof**](#../README)
|
|
2301
2345
|
|
|
@@ -2315,35 +2359,35 @@ type FieldType =
|
|
|
2315
2359
|
|
|
2316
2360
|
Union of string literals representing the possible types of an object field.
|
|
2317
2361
|
|
|
2318
|
-
|
|
2362
|
+
### <a id="IdentityFunction"></a>IdentityFunction
|
|
2319
2363
|
|
|
2320
2364
|
[**@xylabs/typeof**](#../README)
|
|
2321
2365
|
|
|
2322
2366
|
***
|
|
2323
2367
|
|
|
2324
2368
|
```ts
|
|
2325
|
-
type IdentityFunction<T> = (value
|
|
2369
|
+
type IdentityFunction<T> = (value) => value is T;
|
|
2326
2370
|
```
|
|
2327
2371
|
|
|
2328
2372
|
A type guard function that narrows an unknown value to type T.
|
|
2329
2373
|
|
|
2330
2374
|
## Type Parameters
|
|
2331
2375
|
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2376
|
+
### T
|
|
2377
|
+
|
|
2378
|
+
`T`
|
|
2335
2379
|
|
|
2336
2380
|
## Parameters
|
|
2337
2381
|
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2382
|
+
### value
|
|
2383
|
+
|
|
2384
|
+
`unknown`
|
|
2341
2385
|
|
|
2342
2386
|
## Returns
|
|
2343
2387
|
|
|
2344
2388
|
`value is T`
|
|
2345
2389
|
|
|
2346
|
-
|
|
2390
|
+
### <a id="ObjectTypeShape"></a>ObjectTypeShape
|
|
2347
2391
|
|
|
2348
2392
|
[**@xylabs/typeof**](#../README)
|
|
2349
2393
|
|
|
@@ -2355,7 +2399,7 @@ type ObjectTypeShape = Record<string | number | symbol, FieldType>;
|
|
|
2355
2399
|
|
|
2356
2400
|
Describes the expected shape of an object by mapping each key to its expected field type.
|
|
2357
2401
|
|
|
2358
|
-
|
|
2402
|
+
### <a id="RecordKey"></a>RecordKey
|
|
2359
2403
|
|
|
2360
2404
|
[**@xylabs/typeof**](#../README)
|
|
2361
2405
|
|
|
@@ -2367,7 +2411,7 @@ type RecordKey = string | number | symbol;
|
|
|
2367
2411
|
|
|
2368
2412
|
A union of valid object key types.
|
|
2369
2413
|
|
|
2370
|
-
|
|
2414
|
+
### <a id="TypeOfTypes"></a>TypeOfTypes
|
|
2371
2415
|
|
|
2372
2416
|
[**@xylabs/typeof**](#../README)
|
|
2373
2417
|
|
|
@@ -2390,7 +2434,7 @@ type TypeOfTypes =
|
|
|
2390
2434
|
|
|
2391
2435
|
Union of string literals representing the possible results of the extended `typeOf` function.
|
|
2392
2436
|
|
|
2393
|
-
|
|
2437
|
+
### <a id="TypedArray"></a>TypedArray
|
|
2394
2438
|
|
|
2395
2439
|
[**@xylabs/typeof**](#../README)
|
|
2396
2440
|
|
|
@@ -2402,7 +2446,7 @@ type TypedArray = TypedValue[];
|
|
|
2402
2446
|
|
|
2403
2447
|
An array of TypedValue elements.
|
|
2404
2448
|
|
|
2405
|
-
|
|
2449
|
+
### <a id="TypedKey"></a>TypedKey
|
|
2406
2450
|
|
|
2407
2451
|
[**@xylabs/typeof**](#../README)
|
|
2408
2452
|
|
|
@@ -2416,11 +2460,11 @@ A valid key for a typed object. Defaults to string | number | symbol unless narr
|
|
|
2416
2460
|
|
|
2417
2461
|
## Type Parameters
|
|
2418
2462
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2463
|
+
### T
|
|
2464
|
+
|
|
2465
|
+
`T` *extends* `string` \| `void` = `void`
|
|
2422
2466
|
|
|
2423
|
-
|
|
2467
|
+
### <a id="TypedObject"></a>TypedObject
|
|
2424
2468
|
|
|
2425
2469
|
[**@xylabs/typeof**](#../README)
|
|
2426
2470
|
|
|
@@ -2436,7 +2480,7 @@ type TypedObject =
|
|
|
2436
2480
|
|
|
2437
2481
|
An object whose keys are TypedKey and whose values are TypedValue.
|
|
2438
2482
|
|
|
2439
|
-
|
|
2483
|
+
### <a id="TypedValue"></a>TypedValue
|
|
2440
2484
|
|
|
2441
2485
|
[**@xylabs/typeof**](#../README)
|
|
2442
2486
|
|
|
@@ -2459,41 +2503,7 @@ type TypedValue =
|
|
|
2459
2503
|
A value that can appear in a typed object tree (primitives, objects, arrays, functions, and symbols).
|
|
2460
2504
|
|
|
2461
2505
|
|
|
2462
|
-
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
2463
|
-
|
|
2464
|
-
## Maintainers
|
|
2465
|
-
|
|
2466
|
-
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
2467
|
-
- [Matt Jones](https://github.com/jonesmac)
|
|
2468
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
2469
|
-
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
2470
|
-
|
|
2471
|
-
## License
|
|
2472
|
-
|
|
2473
|
-
> See the [LICENSE](LICENSE) file for license details
|
|
2474
|
-
|
|
2475
|
-
## Credits
|
|
2476
|
-
|
|
2477
|
-
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
2478
|
-
|
|
2479
|
-
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
2480
|
-
|
|
2481
|
-
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
2482
|
-
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
2483
2506
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/typeof.svg
|
|
2484
2507
|
[npm-link]: https://www.npmjs.com/package/@xylabs/typeof
|
|
2485
|
-
[
|
|
2486
|
-
[
|
|
2487
|
-
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
2488
|
-
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
2489
|
-
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
2490
|
-
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
2491
|
-
|
|
2492
|
-
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/typeof
|
|
2493
|
-
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/typeof
|
|
2494
|
-
|
|
2495
|
-
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/typeof/badge
|
|
2496
|
-
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/typeof
|
|
2497
|
-
|
|
2498
|
-
[socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/typeof
|
|
2499
|
-
[socket-link]: https://socket.dev/npm/package/@xylabs/typeof
|
|
2508
|
+
[license-badge]: https://img.shields.io/npm/l/@xylabs/typeof.svg
|
|
2509
|
+
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|