@orkestrel/contract 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,31 @@
1
- import type { AnyAsyncFunction, AnyConstructor, AnyFunction, JSONPrimitive, JSONValue, ZeroArgAsyncFunction, ZeroArgFunction } from './types.js';
2
- /** Determine whether a value is `null`. */
1
+ import { AnyAsyncFunction, AnyConstructor, AnyFunction, JSONPrimitive, JSONValue, ZeroArgAsyncFunction, ZeroArgFunction } from './types.js';
2
+ /** Determine whether a value is `null`.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * isNull(null) // true
7
+ * isNull(undefined) // false
8
+ * ```
9
+ */
3
10
  export declare function isNull(value: unknown): value is null;
4
- /** Determine whether a value is `undefined`. */
11
+ /** Determine whether a value is `undefined`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * isUndefined(undefined) // true
16
+ * isUndefined(null) // false
17
+ * ```
18
+ */
5
19
  export declare function isUndefined(value: unknown): value is undefined;
6
- /** Determine whether a value is defined (neither `null` nor `undefined`). */
20
+ /** Determine whether a value is defined (neither `null` nor `undefined`).
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * isDefined('hi') // true
25
+ * isDefined(null) // false
26
+ * isDefined(undefined) // false
27
+ * ```
28
+ */
7
29
  export declare function isDefined<T>(value: T | null | undefined): value is T;
8
30
  /** Determine whether a value is a string. */
9
31
  export declare function isString(value: unknown): value is string;
@@ -16,33 +38,134 @@ export declare function isString(value: unknown): value is string;
16
38
  export declare function isNumber(value: unknown): value is number;
17
39
  /** Determine whether a value is a finite number (excludes `NaN` and `±Infinity`). */
18
40
  export declare function isFiniteNumber(value: unknown): value is number;
19
- /** Determine whether a value is a finite integer (excludes `NaN`, `±Infinity`, and fractional numbers). */
41
+ /** Determine whether a value is a finite integer (excludes `NaN`, `±Infinity`, and fractional numbers).
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * isInteger(3) // true
46
+ * isInteger(3.5) // false
47
+ * ```
48
+ */
20
49
  export declare function isInteger(value: unknown): value is number;
21
- /** Determine whether a value is a boolean. */
50
+ /** Determine whether a value is a boolean.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * isBoolean(true) // true
55
+ * isBoolean(1) // false
56
+ * ```
57
+ */
22
58
  export declare function isBoolean(value: unknown): value is boolean;
23
- /** Determine whether a value is exactly `true`. */
59
+ /** Determine whether a value is exactly `true`.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * isTrue(true) // true
64
+ * isTrue(false) // false
65
+ * ```
66
+ */
24
67
  export declare function isTrue(value: unknown): value is true;
25
- /** Determine whether a value is exactly `false`. */
68
+ /** Determine whether a value is exactly `false`.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * isFalse(false) // true
73
+ * isFalse(true) // false
74
+ * ```
75
+ */
26
76
  export declare function isFalse(value: unknown): value is false;
27
- /** Determine whether a value is a bigint. */
77
+ /** Determine whether a value is a bigint.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * isBigInt(1n) // true
82
+ * isBigInt(1) // false
83
+ * ```
84
+ */
28
85
  export declare function isBigInt(value: unknown): value is bigint;
29
- /** Determine whether a value is a symbol. */
86
+ /** Determine whether a value is a symbol.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * isSymbol(Symbol('x')) // true
91
+ * isSymbol('x') // false
92
+ * ```
93
+ */
30
94
  export declare function isSymbol(value: unknown): value is symbol;
31
- /** Determine whether a value is callable. */
95
+ /** Determine whether a value is callable.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * isFunction(() => {}) // true
100
+ * isFunction({}) // false
101
+ * ```
102
+ */
32
103
  export declare function isFunction(value: unknown): value is AnyFunction;
33
- /** Determine whether a value is a string or `null`. */
104
+ /** Determine whether a value is a string or `null`.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * isNullableString('hi') // true
109
+ * isNullableString(null) // true
110
+ * isNullableString(42) // false
111
+ * ```
112
+ */
34
113
  export declare function isNullableString(value: unknown): value is string | null;
35
- /** Determine whether a value is a number or `null` (the number may be `NaN` / `±Infinity`). */
114
+ /** Determine whether a value is a number or `null` (the number may be `NaN` / `±Infinity`).
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * isNullableNumber(42) // true
119
+ * isNullableNumber(null) // true
120
+ * isNullableNumber('hi') // false
121
+ * ```
122
+ */
36
123
  export declare function isNullableNumber(value: unknown): value is number | null;
37
- /** Determine whether a value is a boolean or `null`. */
124
+ /** Determine whether a value is a boolean or `null`.
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * isNullableBoolean(true) // true
129
+ * isNullableBoolean(null) // true
130
+ * isNullableBoolean(1) // false
131
+ * ```
132
+ */
38
133
  export declare function isNullableBoolean(value: unknown): value is boolean | null;
39
- /** Determine whether a value is a `Date`. */
134
+ /** Determine whether a value is a `Date`.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * isDate(new Date()) // true
139
+ * isDate('2024-01-01') // false
140
+ * ```
141
+ */
40
142
  export declare function isDate(value: unknown): value is Date;
41
- /** Determine whether a value is a `RegExp`. */
143
+ /** Determine whether a value is a `RegExp`.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * isRegExp(/a/) // true
148
+ * isRegExp('a') // false
149
+ * ```
150
+ */
42
151
  export declare function isRegExp(value: unknown): value is RegExp;
43
- /** Determine whether a value is an `Error`. */
152
+ /** Determine whether a value is an `Error`.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * isError(new Error('boom')) // true
157
+ * isError('boom') // false
158
+ * ```
159
+ */
44
160
  export declare function isError(value: unknown): value is Error;
45
- /** Determine whether a value is a native `Promise` (use {@link isPromiseLike} for any thenable). */
161
+ /** Determine whether a value is a native `Promise` (use {@link isPromiseLike} for any thenable).
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * isPromise(Promise.resolve()) // true
166
+ * isPromise({ then() {} }) // false
167
+ * ```
168
+ */
46
169
  export declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
47
170
  /**
48
171
  * Determine whether a value is promise-like — an object exposing callable
@@ -51,12 +174,26 @@ export declare function isPromise<T = unknown>(value: unknown): value is Promise
51
174
  * @remarks
52
175
  * Accepts any object with all three methods, not only native `Promise`
53
176
  * instances. Use {@link isPromise} when you specifically need `instanceof Promise`.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * isPromiseLike(Promise.resolve()) // true
181
+ * isPromiseLike({ then() {}, catch() {}, finally() {} }) // true
182
+ * isPromiseLike({ then() {} }) // false
183
+ * ```
54
184
  */
55
185
  export declare function isPromiseLike<T = unknown>(value: unknown): value is Promise<T> | (PromiseLike<T> & {
56
186
  catch: unknown;
57
187
  finally: unknown;
58
188
  });
59
- /** Determine whether a value is an `ArrayBuffer`. */
189
+ /** Determine whether a value is an `ArrayBuffer`.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * isArrayBuffer(new ArrayBuffer(8)) // true
194
+ * isArrayBuffer([]) // false
195
+ * ```
196
+ */
60
197
  export declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
61
198
  /**
62
199
  * Determine whether a value is a `SharedArrayBuffer`.
@@ -64,6 +201,12 @@ export declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
64
201
  * @remarks
65
202
  * Guards the global existence of `SharedArrayBuffer` first — safe where it is
66
203
  * absent or disabled (e.g. a context that is not cross-origin isolated).
204
+ *
205
+ * @example
206
+ * ```ts
207
+ * isSharedArrayBuffer(new SharedArrayBuffer(8)) // true
208
+ * isSharedArrayBuffer(new ArrayBuffer(8)) // false
209
+ * ```
67
210
  */
68
211
  export declare function isSharedArrayBuffer(value: unknown): value is SharedArrayBuffer;
69
212
  /**
@@ -72,9 +215,23 @@ export declare function isSharedArrayBuffer(value: unknown): value is SharedArra
72
215
  * @remarks
73
216
  * Strings are explicitly included: a string has a callable `Symbol.iterator`
74
217
  * but is not an object, so the generic object path alone would miss it.
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * isIterable([1, 2]) // true
222
+ * isIterable('abc') // true
223
+ * isIterable({ a: 1 }) // false
224
+ * ```
75
225
  */
76
226
  export declare function isIterable<T = unknown>(value: unknown): value is Iterable<T>;
77
- /** Determine whether a value implements the async iterable protocol (`Symbol.asyncIterator`). */
227
+ /** Determine whether a value implements the async iterable protocol (`Symbol.asyncIterator`).
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * isAsyncIterable({ [Symbol.asyncIterator]() {} }) // true
232
+ * isAsyncIterable([1, 2]) // false
233
+ * ```
234
+ */
78
235
  export declare function isAsyncIterable<T = unknown>(value: unknown): value is AsyncIterable<T>;
79
236
  /**
80
237
  * Determine whether a value is a non-null object.
@@ -82,6 +239,13 @@ export declare function isAsyncIterable<T = unknown>(value: unknown): value is A
82
239
  * @remarks
83
240
  * `true` for arrays, class instances, plain objects, `Map`, `Set`, etc. — use
84
241
  * {@link isRecord} when you need a plain-record check.
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * isObject({}) // true
246
+ * isObject([]) // true
247
+ * isObject(null) // false
248
+ * ```
85
249
  */
86
250
  export declare function isObject(value: unknown): value is object;
87
251
  /**
@@ -103,37 +267,149 @@ export declare function isObject(value: unknown): value is object;
103
267
  * `getPrototypeOf` trap cannot escape as a thrown error.
104
268
  */
105
269
  export declare function isRecord(value: unknown): value is Record<string, unknown>;
106
- /** Determine whether a value is a `Map`. */
270
+ /** Determine whether a value is a `Map`.
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * isMap(new Map()) // true
275
+ * isMap({}) // false
276
+ * ```
277
+ */
107
278
  export declare function isMap<K = unknown, V = unknown>(value: unknown): value is ReadonlyMap<K, V>;
108
- /** Determine whether a value is a `Set`. */
279
+ /** Determine whether a value is a `Set`.
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * isSet(new Set()) // true
284
+ * isSet([]) // false
285
+ * ```
286
+ */
109
287
  export declare function isSet<T = unknown>(value: unknown): value is ReadonlySet<T>;
110
- /** Determine whether a value is a `WeakMap`. */
288
+ /** Determine whether a value is a `WeakMap`.
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * isWeakMap(new WeakMap()) // true
293
+ * isWeakMap({}) // false
294
+ * ```
295
+ */
111
296
  export declare function isWeakMap(value: unknown): value is WeakMap<object, unknown>;
112
- /** Determine whether a value is a `WeakSet`. */
297
+ /** Determine whether a value is a `WeakSet`.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * isWeakSet(new WeakSet()) // true
302
+ * isWeakSet({}) // false
303
+ * ```
304
+ */
113
305
  export declare function isWeakSet(value: unknown): value is WeakSet<object>;
114
- /** Determine whether a value is an array. */
306
+ /** Determine whether a value is an array.
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * isArray([1, 2]) // true
311
+ * isArray('12') // false
312
+ * ```
313
+ */
115
314
  export declare function isArray<T = unknown>(value: unknown): value is readonly T[];
116
- /** Determine whether a value is a `DataView`. */
315
+ /** Determine whether a value is a `DataView`.
316
+ *
317
+ * @example
318
+ * ```ts
319
+ * isDataView(new DataView(new ArrayBuffer(8))) // true
320
+ * isDataView(new ArrayBuffer(8)) // false
321
+ * ```
322
+ */
117
323
  export declare function isDataView(value: unknown): value is DataView<ArrayBufferLike>;
118
- /** Determine whether a value is an `ArrayBufferView` (any typed array or `DataView`). */
324
+ /** Determine whether a value is an `ArrayBufferView` (any typed array or `DataView`).
325
+ *
326
+ * @example
327
+ * ```ts
328
+ * isArrayBufferView(new Uint8Array(4)) // true
329
+ * isArrayBufferView([1, 2, 3, 4]) // false
330
+ * ```
331
+ */
119
332
  export declare function isArrayBufferView(value: unknown): value is ArrayBufferView;
120
- /** Determine whether a value is an `Int8Array`. */
333
+ /** Determine whether a value is an `Int8Array`.
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * isInt8Array(new Int8Array(2)) // true
338
+ * isInt8Array(new Uint8Array(2)) // false
339
+ * ```
340
+ */
121
341
  export declare function isInt8Array(value: unknown): value is Int8Array;
122
- /** Determine whether a value is a `Uint8Array`. */
342
+ /** Determine whether a value is a `Uint8Array`.
343
+ *
344
+ * @example
345
+ * ```ts
346
+ * isUint8Array(new Uint8Array(2)) // true
347
+ * isUint8Array(new Int8Array(2)) // false
348
+ * ```
349
+ */
123
350
  export declare function isUint8Array(value: unknown): value is Uint8Array;
124
- /** Determine whether a value is a `Uint8ClampedArray`. */
351
+ /** Determine whether a value is a `Uint8ClampedArray`.
352
+ *
353
+ * @example
354
+ * ```ts
355
+ * isUint8ClampedArray(new Uint8ClampedArray(2)) // true
356
+ * isUint8ClampedArray(new Uint8Array(2)) // false
357
+ * ```
358
+ */
125
359
  export declare function isUint8ClampedArray(value: unknown): value is Uint8ClampedArray;
126
- /** Determine whether a value is an `Int16Array`. */
360
+ /** Determine whether a value is an `Int16Array`.
361
+ *
362
+ * @example
363
+ * ```ts
364
+ * isInt16Array(new Int16Array(2)) // true
365
+ * isInt16Array(new Int8Array(2)) // false
366
+ * ```
367
+ */
127
368
  export declare function isInt16Array(value: unknown): value is Int16Array;
128
- /** Determine whether a value is a `Uint16Array`. */
369
+ /** Determine whether a value is a `Uint16Array`.
370
+ *
371
+ * @example
372
+ * ```ts
373
+ * isUint16Array(new Uint16Array(2)) // true
374
+ * isUint16Array(new Int16Array(2)) // false
375
+ * ```
376
+ */
129
377
  export declare function isUint16Array(value: unknown): value is Uint16Array;
130
- /** Determine whether a value is an `Int32Array`. */
378
+ /** Determine whether a value is an `Int32Array`.
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * isInt32Array(new Int32Array(2)) // true
383
+ * isInt32Array(new Int16Array(2)) // false
384
+ * ```
385
+ */
131
386
  export declare function isInt32Array(value: unknown): value is Int32Array;
132
- /** Determine whether a value is a `Uint32Array`. */
387
+ /** Determine whether a value is a `Uint32Array`.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * isUint32Array(new Uint32Array(2)) // true
392
+ * isUint32Array(new Int32Array(2)) // false
393
+ * ```
394
+ */
133
395
  export declare function isUint32Array(value: unknown): value is Uint32Array;
134
- /** Determine whether a value is a `Float32Array`. */
396
+ /** Determine whether a value is a `Float32Array`.
397
+ *
398
+ * @example
399
+ * ```ts
400
+ * isFloat32Array(new Float32Array(2)) // true
401
+ * isFloat32Array(new Float64Array(2)) // false
402
+ * ```
403
+ */
135
404
  export declare function isFloat32Array(value: unknown): value is Float32Array;
136
- /** Determine whether a value is a `Float64Array`. */
405
+ /** Determine whether a value is a `Float64Array`.
406
+ *
407
+ * @example
408
+ * ```ts
409
+ * isFloat64Array(new Float64Array(2)) // true
410
+ * isFloat64Array(new Float32Array(2)) // false
411
+ * ```
412
+ */
137
413
  export declare function isFloat64Array(value: unknown): value is Float64Array;
138
414
  /**
139
415
  * Determine whether a value is a `BigInt64Array`.
@@ -141,6 +417,12 @@ export declare function isFloat64Array(value: unknown): value is Float64Array;
141
417
  * @remarks
142
418
  * Guards the global existence of `BigInt64Array` first — safe in environments
143
419
  * that pre-date the BigInt typed-array additions.
420
+ *
421
+ * @example
422
+ * ```ts
423
+ * isBigInt64Array(new BigInt64Array(2)) // true
424
+ * isBigInt64Array(new Float64Array(2)) // false
425
+ * ```
144
426
  */
145
427
  export declare function isBigInt64Array(value: unknown): value is BigInt64Array;
146
428
  /**
@@ -149,29 +431,112 @@ export declare function isBigInt64Array(value: unknown): value is BigInt64Array;
149
431
  * @remarks
150
432
  * Guards the global existence of `BigUint64Array` first — safe in environments
151
433
  * that pre-date the BigInt typed-array additions.
434
+ *
435
+ * @example
436
+ * ```ts
437
+ * isBigUint64Array(new BigUint64Array(2)) // true
438
+ * isBigUint64Array(new BigInt64Array(2)) // false
439
+ * ```
152
440
  */
153
441
  export declare function isBigUint64Array(value: unknown): value is BigUint64Array;
154
- /** Determine whether a value is the empty string `''`. */
442
+ /** Determine whether a value is the empty string `''`.
443
+ *
444
+ * @example
445
+ * ```ts
446
+ * isEmptyString('') // true
447
+ * isEmptyString('a') // false
448
+ * ```
449
+ */
155
450
  export declare function isEmptyString(value: unknown): value is '';
156
- /** Determine whether a value is an empty array. */
451
+ /** Determine whether a value is an empty array.
452
+ *
453
+ * @example
454
+ * ```ts
455
+ * isEmptyArray([]) // true
456
+ * isEmptyArray([1]) // false
457
+ * ```
458
+ */
157
459
  export declare function isEmptyArray(value: unknown): value is readonly [];
158
- /** Determine whether a value is an empty plain object (no own string or enumerable symbol keys). */
460
+ /** Determine whether a value is an empty plain object (no own string or enumerable symbol keys).
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * isEmptyObject({}) // true
465
+ * isEmptyObject({ a: 1 }) // false
466
+ * ```
467
+ */
159
468
  export declare function isEmptyObject(value: unknown): value is Record<string | symbol, never>;
160
- /** Determine whether a value is an empty `Map`. */
469
+ /** Determine whether a value is an empty `Map`.
470
+ *
471
+ * @example
472
+ * ```ts
473
+ * isEmptyMap(new Map()) // true
474
+ * isEmptyMap(new Map([['a', 1]])) // false
475
+ * ```
476
+ */
161
477
  export declare function isEmptyMap(value: unknown): value is ReadonlyMap<never, never>;
162
- /** Determine whether a value is an empty `Set`. */
478
+ /** Determine whether a value is an empty `Set`.
479
+ *
480
+ * @example
481
+ * ```ts
482
+ * isEmptySet(new Set()) // true
483
+ * isEmptySet(new Set([1])) // false
484
+ * ```
485
+ */
163
486
  export declare function isEmptySet(value: unknown): value is ReadonlySet<never>;
164
- /** Determine whether a value is a non-empty string (at least one character). */
487
+ /** Determine whether a value is a non-empty string (at least one character).
488
+ *
489
+ * @example
490
+ * ```ts
491
+ * isNonEmptyString('a') // true
492
+ * isNonEmptyString('') // false
493
+ * ```
494
+ */
165
495
  export declare function isNonEmptyString(value: unknown): value is string;
166
- /** Determine whether a value is a non-empty array (at least one element). */
496
+ /** Determine whether a value is a non-empty array (at least one element).
497
+ *
498
+ * @example
499
+ * ```ts
500
+ * isNonEmptyArray([1]) // true
501
+ * isNonEmptyArray([]) // false
502
+ * ```
503
+ */
167
504
  export declare function isNonEmptyArray<T = unknown>(value: unknown): value is readonly [T, ...T[]];
168
- /** Determine whether a value is a non-empty plain object (at least one own string or enumerable symbol key). */
505
+ /** Determine whether a value is a non-empty plain object (at least one own string or enumerable symbol key).
506
+ *
507
+ * @example
508
+ * ```ts
509
+ * isNonEmptyObject({ a: 1 }) // true
510
+ * isNonEmptyObject({}) // false
511
+ * ```
512
+ */
169
513
  export declare function isNonEmptyObject(value: unknown): value is Record<string | symbol, unknown>;
170
- /** Determine whether a value is a non-empty `Map` (at least one entry). */
514
+ /** Determine whether a value is a non-empty `Map` (at least one entry).
515
+ *
516
+ * @example
517
+ * ```ts
518
+ * isNonEmptyMap(new Map([['a', 1]])) // true
519
+ * isNonEmptyMap(new Map()) // false
520
+ * ```
521
+ */
171
522
  export declare function isNonEmptyMap<K = unknown, V = unknown>(value: unknown): value is ReadonlyMap<K, V>;
172
- /** Determine whether a value is a non-empty `Set` (at least one element). */
523
+ /** Determine whether a value is a non-empty `Set` (at least one element).
524
+ *
525
+ * @example
526
+ * ```ts
527
+ * isNonEmptySet(new Set([1])) // true
528
+ * isNonEmptySet(new Set()) // false
529
+ * ```
530
+ */
173
531
  export declare function isNonEmptySet<T = unknown>(value: unknown): value is ReadonlySet<T>;
174
- /** Determine whether a value is a function that declares zero parameters (`Function.length === 0`). */
532
+ /** Determine whether a value is a function that declares zero parameters (`Function.length === 0`).
533
+ *
534
+ * @example
535
+ * ```ts
536
+ * isZeroArg(() => {}) // true
537
+ * isZeroArg((a) => a) // false
538
+ * ```
539
+ */
175
540
  export declare function isZeroArg(value: unknown): value is ZeroArgFunction;
176
541
  /**
177
542
  * Determine whether a value is a native `async function`.
@@ -180,17 +545,58 @@ export declare function isZeroArg(value: unknown): value is ZeroArgFunction;
180
545
  * Uses `constructor.name === 'AsyncFunction'` — not `instanceof`, which is
181
546
  * unreliable across realms. The `?.` keeps the guard total (§14): a function
182
547
  * whose `constructor` was nulled yields `undefined`, never a thrown `null.name`.
548
+ *
549
+ * @example
550
+ * ```ts
551
+ * isAsyncFunction(async () => {}) // true
552
+ * isAsyncFunction(() => {}) // false
553
+ * ```
183
554
  */
184
555
  export declare function isAsyncFunction(value: unknown): value is AnyAsyncFunction;
185
- /** Determine whether a value is a generator function (`function*`). */
556
+ /** Determine whether a value is a generator function (`function*`).
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * isGeneratorFunction(function* () {}) // true
561
+ * isGeneratorFunction(() => {}) // false
562
+ * ```
563
+ */
186
564
  export declare function isGeneratorFunction(value: unknown): value is (...args: unknown[]) => Generator<unknown, unknown, unknown>;
187
- /** Determine whether a value is an async generator function (`async function*`). */
565
+ /** Determine whether a value is an async generator function (`async function*`).
566
+ *
567
+ * @example
568
+ * ```ts
569
+ * isAsyncGeneratorFunction(async function* () {}) // true
570
+ * isAsyncGeneratorFunction(function* () {}) // false
571
+ * ```
572
+ */
188
573
  export declare function isAsyncGeneratorFunction(value: unknown): value is (...args: unknown[]) => AsyncGenerator<unknown, unknown, unknown>;
189
- /** Determine whether a value is a zero-argument async function. */
574
+ /** Determine whether a value is a zero-argument async function.
575
+ *
576
+ * @example
577
+ * ```ts
578
+ * isZeroArgAsync(async () => {}) // true
579
+ * isZeroArgAsync(async (a) => a) // false
580
+ * ```
581
+ */
190
582
  export declare function isZeroArgAsync(value: unknown): value is ZeroArgAsyncFunction;
191
- /** Determine whether a value is a zero-argument generator function. */
583
+ /** Determine whether a value is a zero-argument generator function.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * isZeroArgGenerator(function* () {}) // true
588
+ * isZeroArgGenerator(function* (a) {}) // false
589
+ * ```
590
+ */
192
591
  export declare function isZeroArgGenerator(value: unknown): value is () => Generator<unknown, unknown, unknown>;
193
- /** Determine whether a value is a zero-argument async generator function. */
592
+ /** Determine whether a value is a zero-argument async generator function.
593
+ *
594
+ * @example
595
+ * ```ts
596
+ * isZeroArgAsyncGenerator(async function* () {}) // true
597
+ * isZeroArgAsyncGenerator(async function* (a) {}) // false
598
+ * ```
599
+ */
194
600
  export declare function isZeroArgAsyncGenerator(value: unknown): value is () => AsyncGenerator<unknown, unknown, unknown>;
195
601
  /**
196
602
  * Determine whether a value can be used as a `new`-target constructor.
@@ -199,6 +605,12 @@ export declare function isZeroArgAsyncGenerator(value: unknown): value is () =>
199
605
  * Probes with `Reflect.construct(String, [], value)`: a real constructor
200
606
  * succeeds, while arrow functions, plain functions, and non-functions throw
201
607
  * and yield `false`. Never throws. Backs the `instanceOf` combinator.
608
+ *
609
+ * @example
610
+ * ```ts
611
+ * isConstructor(class X {}) // true
612
+ * isConstructor(() => {}) // false
613
+ * ```
202
614
  */
203
615
  export declare function isConstructor(value: unknown): value is AnyConstructor<object>;
204
616
  /**