@orkestrel/contract 0.0.5 → 0.0.6

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,717 +0,0 @@
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
- */
10
- export declare function isNull(value: unknown): value is null;
11
- /** Determine whether a value is `undefined`.
12
- *
13
- * @example
14
- * ```ts
15
- * isUndefined(undefined) // true
16
- * isUndefined(null) // false
17
- * ```
18
- */
19
- export declare function isUndefined(value: unknown): value is 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
- */
29
- export declare function isDefined<T>(value: T | null | undefined): value is T;
30
- /** Determine whether a value is a string.
31
- *
32
- * @example
33
- * ```ts
34
- * isString('hi') // true
35
- * isString(42) // false
36
- * ```
37
- */
38
- export declare function isString(value: unknown): value is string;
39
- /**
40
- * Determine whether a value is a number.
41
- *
42
- * @remarks
43
- * Includes `NaN` and `±Infinity` — use {@link isFiniteNumber} to exclude them.
44
- *
45
- * @example
46
- * ```ts
47
- * isNumber(42) // true
48
- * isNumber(Number.NaN) // true — NaN is still a number
49
- * isNumber('42') // false
50
- * ```
51
- */
52
- export declare function isNumber(value: unknown): value is number;
53
- /** Determine whether a value is a finite number (excludes `NaN` and `±Infinity`).
54
- *
55
- * @example
56
- * ```ts
57
- * isFiniteNumber(42) // true
58
- * isFiniteNumber(Number.NaN) // false
59
- * isFiniteNumber(Infinity) // false
60
- * ```
61
- */
62
- export declare function isFiniteNumber(value: unknown): value is number;
63
- /** Determine whether a value is a finite integer (excludes `NaN`, `±Infinity`, and fractional numbers).
64
- *
65
- * @example
66
- * ```ts
67
- * isInteger(3) // true
68
- * isInteger(3.5) // false
69
- * ```
70
- */
71
- export declare function isInteger(value: unknown): value is number;
72
- /** Determine whether a value is a boolean.
73
- *
74
- * @example
75
- * ```ts
76
- * isBoolean(true) // true
77
- * isBoolean(1) // false
78
- * ```
79
- */
80
- export declare function isBoolean(value: unknown): value is boolean;
81
- /** Determine whether a value is exactly `true`.
82
- *
83
- * @example
84
- * ```ts
85
- * isTrue(true) // true
86
- * isTrue(false) // false
87
- * ```
88
- */
89
- export declare function isTrue(value: unknown): value is true;
90
- /** Determine whether a value is exactly `false`.
91
- *
92
- * @example
93
- * ```ts
94
- * isFalse(false) // true
95
- * isFalse(true) // false
96
- * ```
97
- */
98
- export declare function isFalse(value: unknown): value is false;
99
- /** Determine whether a value is a bigint.
100
- *
101
- * @example
102
- * ```ts
103
- * isBigInt(1n) // true
104
- * isBigInt(1) // false
105
- * ```
106
- */
107
- export declare function isBigInt(value: unknown): value is bigint;
108
- /** Determine whether a value is a symbol.
109
- *
110
- * @example
111
- * ```ts
112
- * isSymbol(Symbol('x')) // true
113
- * isSymbol('x') // false
114
- * ```
115
- */
116
- export declare function isSymbol(value: unknown): value is symbol;
117
- /** Determine whether a value is callable.
118
- *
119
- * @example
120
- * ```ts
121
- * isFunction(() => {}) // true
122
- * isFunction({}) // false
123
- * ```
124
- */
125
- export declare function isFunction(value: unknown): value is AnyFunction;
126
- /** Determine whether a value is a string or `null`.
127
- *
128
- * @example
129
- * ```ts
130
- * isNullableString('hi') // true
131
- * isNullableString(null) // true
132
- * isNullableString(42) // false
133
- * ```
134
- */
135
- export declare function isNullableString(value: unknown): value is string | null;
136
- /** Determine whether a value is a number or `null` (the number may be `NaN` / `±Infinity`).
137
- *
138
- * @example
139
- * ```ts
140
- * isNullableNumber(42) // true
141
- * isNullableNumber(null) // true
142
- * isNullableNumber('hi') // false
143
- * ```
144
- */
145
- export declare function isNullableNumber(value: unknown): value is number | null;
146
- /** Determine whether a value is a boolean or `null`.
147
- *
148
- * @example
149
- * ```ts
150
- * isNullableBoolean(true) // true
151
- * isNullableBoolean(null) // true
152
- * isNullableBoolean(1) // false
153
- * ```
154
- */
155
- export declare function isNullableBoolean(value: unknown): value is boolean | null;
156
- /**
157
- * Determine whether a value is an instance of a constructor, contained against
158
- * a throwing `instanceof` check.
159
- *
160
- * @remarks
161
- * The low-level total helper every `instanceof`-based guard in this file (and
162
- * the `instanceOf` combinator) routes through. A bare `value instanceof X` is
163
- * NOT total (AGENTS §14): it invokes `getPrototypeOf` on `value` — which a
164
- * revoked `Proxy` or a `getPrototypeOf`-trap `Proxy` throws from — and, when
165
- * `X[Symbol.hasInstance]` is user-defined, can throw from arbitrary code. This
166
- * wraps the check in {@link attempt} (see ./helpers.js) so any such throw
167
- * yields `false` instead of escaping.
168
- *
169
- * @param value - The value to test
170
- * @param ctor - The constructor to test against
171
- * @returns `true` when `value instanceof ctor`, `false` on a non-match or a
172
- * contained throw
173
- *
174
- * @example
175
- * ```ts
176
- * isInstance(new Date(), Date) // true
177
- * isInstance({}, Date) // false
178
- * ```
179
- */
180
- export declare function isInstance<C>(value: unknown, ctor: C): value is InstanceType<C & AnyConstructor<object>>;
181
- /** Determine whether a value is a `Date`.
182
- *
183
- * @example
184
- * ```ts
185
- * isDate(new Date()) // true
186
- * isDate('2024-01-01') // false
187
- * ```
188
- */
189
- export declare function isDate(value: unknown): value is Date;
190
- /** Determine whether a value is a `RegExp`.
191
- *
192
- * @example
193
- * ```ts
194
- * isRegExp(/a/) // true
195
- * isRegExp('a') // false
196
- * ```
197
- */
198
- export declare function isRegExp(value: unknown): value is RegExp;
199
- /** Determine whether a value is an `Error`.
200
- *
201
- * @example
202
- * ```ts
203
- * isError(new Error('boom')) // true
204
- * isError('boom') // false
205
- * ```
206
- */
207
- export declare function isError(value: unknown): value is Error;
208
- /** Determine whether a value is a native `Promise` (use {@link isPromiseLike} for any thenable).
209
- *
210
- * @example
211
- * ```ts
212
- * isPromise(Promise.resolve()) // true
213
- * isPromise({ then() {} }) // false
214
- * ```
215
- */
216
- export declare function isPromise<T = unknown>(value: unknown): value is Promise<T>;
217
- /**
218
- * Determine whether a value is promise-like — an object exposing callable
219
- * `then`, `catch`, and `finally` methods.
220
- *
221
- * @remarks
222
- * Accepts any object with all three methods, not only native `Promise`
223
- * instances. Use {@link isPromise} when you specifically need `instanceof Promise`.
224
- *
225
- * @example
226
- * ```ts
227
- * isPromiseLike(Promise.resolve()) // true
228
- * isPromiseLike({ then() {}, catch() {}, finally() {} }) // true
229
- * isPromiseLike({ then() {} }) // false
230
- * ```
231
- */
232
- export declare function isPromiseLike<T = unknown>(value: unknown): value is Promise<T> | (PromiseLike<T> & {
233
- catch: unknown;
234
- finally: unknown;
235
- });
236
- /** Determine whether a value is an `ArrayBuffer`.
237
- *
238
- * @example
239
- * ```ts
240
- * isArrayBuffer(new ArrayBuffer(8)) // true
241
- * isArrayBuffer([]) // false
242
- * ```
243
- */
244
- export declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
245
- /**
246
- * Determine whether a value is a `SharedArrayBuffer`.
247
- *
248
- * @remarks
249
- * Guards the global existence of `SharedArrayBuffer` first — safe where it is
250
- * absent or disabled (e.g. a context that is not cross-origin isolated).
251
- *
252
- * @example
253
- * ```ts
254
- * isSharedArrayBuffer(new SharedArrayBuffer(8)) // true
255
- * isSharedArrayBuffer(new ArrayBuffer(8)) // false
256
- * ```
257
- */
258
- export declare function isSharedArrayBuffer(value: unknown): value is SharedArrayBuffer;
259
- /**
260
- * Determine whether a value implements the iterable protocol (`Symbol.iterator`).
261
- *
262
- * @remarks
263
- * Strings are explicitly included: a string has a callable `Symbol.iterator`
264
- * but is not an object, so the generic object path alone would miss it.
265
- *
266
- * @example
267
- * ```ts
268
- * isIterable([1, 2]) // true
269
- * isIterable('abc') // true
270
- * isIterable({ a: 1 }) // false
271
- * ```
272
- */
273
- export declare function isIterable<T = unknown>(value: unknown): value is Iterable<T>;
274
- /** Determine whether a value implements the async iterable protocol (`Symbol.asyncIterator`).
275
- *
276
- * @example
277
- * ```ts
278
- * isAsyncIterable({ [Symbol.asyncIterator]() {} }) // true
279
- * isAsyncIterable([1, 2]) // false
280
- * ```
281
- */
282
- export declare function isAsyncIterable<T = unknown>(value: unknown): value is AsyncIterable<T>;
283
- /**
284
- * Determine whether a value is a non-null object.
285
- *
286
- * @remarks
287
- * `true` for arrays, class instances, plain objects, `Map`, `Set`, etc. — use
288
- * {@link isRecord} when you need a plain-record check.
289
- *
290
- * @example
291
- * ```ts
292
- * isObject({}) // true
293
- * isObject([]) // true
294
- * isObject(null) // false
295
- * ```
296
- */
297
- export declare function isObject(value: unknown): value is object;
298
- /**
299
- * Determine whether a value is a plain record (object literal or null-prototype),
300
- * not an array or class instance.
301
- *
302
- * @remarks
303
- * Use instead of {@link isObject} to distinguish a plain `{}` /
304
- * `Object.create(null)` from arrays, `Date`, `Map`, etc. The prototype-chain
305
- * test is realm-agnostic: rather than comparing against the current realm's
306
- * `Object.prototype` (which a plain object from another `vm.Context`, iframe,
307
- * or worker would fail), it accepts any value whose prototype is `null`, OR
308
- * whose prototype's own prototype is `null` — the shape every plain object
309
- * has in every realm, since `Object.prototype` itself always sits one step
310
- * above `null`. Arrays and class instances are still rejected: an array's
311
- * prototype chain runs through `Array.prototype` before `null`, and a class
312
- * instance's runs through the class's own prototype. The whole body runs
313
- * inside `attempt` (AGENTS §14) so a revoked `Proxy` or a hostile
314
- * `getPrototypeOf` trap cannot escape as a thrown error.
315
- *
316
- * @example
317
- * ```ts
318
- * isRecord({ a: 1 }) // true
319
- * isRecord(Object.create(null)) // true
320
- * isRecord([]) // false
321
- * isRecord(new Date()) // false
322
- * ```
323
- */
324
- export declare function isRecord(value: unknown): value is Record<string, unknown>;
325
- /** Determine whether a value is a `Map`.
326
- *
327
- * @example
328
- * ```ts
329
- * isMap(new Map()) // true
330
- * isMap({}) // false
331
- * ```
332
- */
333
- export declare function isMap<K = unknown, V = unknown>(value: unknown): value is ReadonlyMap<K, V>;
334
- /** Determine whether a value is a `Set`.
335
- *
336
- * @example
337
- * ```ts
338
- * isSet(new Set()) // true
339
- * isSet([]) // false
340
- * ```
341
- */
342
- export declare function isSet<T = unknown>(value: unknown): value is ReadonlySet<T>;
343
- /** Determine whether a value is a `WeakMap`.
344
- *
345
- * @example
346
- * ```ts
347
- * isWeakMap(new WeakMap()) // true
348
- * isWeakMap({}) // false
349
- * ```
350
- */
351
- export declare function isWeakMap(value: unknown): value is WeakMap<object, unknown>;
352
- /** Determine whether a value is a `WeakSet`.
353
- *
354
- * @example
355
- * ```ts
356
- * isWeakSet(new WeakSet()) // true
357
- * isWeakSet({}) // false
358
- * ```
359
- */
360
- export declare function isWeakSet(value: unknown): value is WeakSet<object>;
361
- /** Determine whether a value is an array.
362
- *
363
- * @example
364
- * ```ts
365
- * isArray([1, 2]) // true
366
- * isArray('12') // false
367
- * ```
368
- */
369
- export declare function isArray<T = unknown>(value: unknown): value is readonly T[];
370
- /** Determine whether a value is a `DataView`.
371
- *
372
- * @example
373
- * ```ts
374
- * isDataView(new DataView(new ArrayBuffer(8))) // true
375
- * isDataView(new ArrayBuffer(8)) // false
376
- * ```
377
- */
378
- export declare function isDataView(value: unknown): value is DataView<ArrayBufferLike>;
379
- /** Determine whether a value is an `ArrayBufferView` (any typed array or `DataView`).
380
- *
381
- * @example
382
- * ```ts
383
- * isArrayBufferView(new Uint8Array(4)) // true
384
- * isArrayBufferView([1, 2, 3, 4]) // false
385
- * ```
386
- */
387
- export declare function isArrayBufferView(value: unknown): value is ArrayBufferView;
388
- /** Determine whether a value is an `Int8Array`.
389
- *
390
- * @example
391
- * ```ts
392
- * isInt8Array(new Int8Array(2)) // true
393
- * isInt8Array(new Uint8Array(2)) // false
394
- * ```
395
- */
396
- export declare function isInt8Array(value: unknown): value is Int8Array;
397
- /** Determine whether a value is a `Uint8Array`.
398
- *
399
- * @example
400
- * ```ts
401
- * isUint8Array(new Uint8Array(2)) // true
402
- * isUint8Array(new Int8Array(2)) // false
403
- * ```
404
- */
405
- export declare function isUint8Array(value: unknown): value is Uint8Array;
406
- /** Determine whether a value is a `Uint8ClampedArray`.
407
- *
408
- * @example
409
- * ```ts
410
- * isUint8ClampedArray(new Uint8ClampedArray(2)) // true
411
- * isUint8ClampedArray(new Uint8Array(2)) // false
412
- * ```
413
- */
414
- export declare function isUint8ClampedArray(value: unknown): value is Uint8ClampedArray;
415
- /** Determine whether a value is an `Int16Array`.
416
- *
417
- * @example
418
- * ```ts
419
- * isInt16Array(new Int16Array(2)) // true
420
- * isInt16Array(new Int8Array(2)) // false
421
- * ```
422
- */
423
- export declare function isInt16Array(value: unknown): value is Int16Array;
424
- /** Determine whether a value is a `Uint16Array`.
425
- *
426
- * @example
427
- * ```ts
428
- * isUint16Array(new Uint16Array(2)) // true
429
- * isUint16Array(new Int16Array(2)) // false
430
- * ```
431
- */
432
- export declare function isUint16Array(value: unknown): value is Uint16Array;
433
- /** Determine whether a value is an `Int32Array`.
434
- *
435
- * @example
436
- * ```ts
437
- * isInt32Array(new Int32Array(2)) // true
438
- * isInt32Array(new Int16Array(2)) // false
439
- * ```
440
- */
441
- export declare function isInt32Array(value: unknown): value is Int32Array;
442
- /** Determine whether a value is a `Uint32Array`.
443
- *
444
- * @example
445
- * ```ts
446
- * isUint32Array(new Uint32Array(2)) // true
447
- * isUint32Array(new Int32Array(2)) // false
448
- * ```
449
- */
450
- export declare function isUint32Array(value: unknown): value is Uint32Array;
451
- /** Determine whether a value is a `Float32Array`.
452
- *
453
- * @example
454
- * ```ts
455
- * isFloat32Array(new Float32Array(2)) // true
456
- * isFloat32Array(new Float64Array(2)) // false
457
- * ```
458
- */
459
- export declare function isFloat32Array(value: unknown): value is Float32Array;
460
- /** Determine whether a value is a `Float64Array`.
461
- *
462
- * @example
463
- * ```ts
464
- * isFloat64Array(new Float64Array(2)) // true
465
- * isFloat64Array(new Float32Array(2)) // false
466
- * ```
467
- */
468
- export declare function isFloat64Array(value: unknown): value is Float64Array;
469
- /**
470
- * Determine whether a value is a `BigInt64Array`.
471
- *
472
- * @remarks
473
- * Guards the global existence of `BigInt64Array` first — safe in environments
474
- * that pre-date the BigInt typed-array additions.
475
- *
476
- * @example
477
- * ```ts
478
- * isBigInt64Array(new BigInt64Array(2)) // true
479
- * isBigInt64Array(new Float64Array(2)) // false
480
- * ```
481
- */
482
- export declare function isBigInt64Array(value: unknown): value is BigInt64Array;
483
- /**
484
- * Determine whether a value is a `BigUint64Array`.
485
- *
486
- * @remarks
487
- * Guards the global existence of `BigUint64Array` first — safe in environments
488
- * that pre-date the BigInt typed-array additions.
489
- *
490
- * @example
491
- * ```ts
492
- * isBigUint64Array(new BigUint64Array(2)) // true
493
- * isBigUint64Array(new BigInt64Array(2)) // false
494
- * ```
495
- */
496
- export declare function isBigUint64Array(value: unknown): value is BigUint64Array;
497
- /** Determine whether a value is the empty string `''`.
498
- *
499
- * @example
500
- * ```ts
501
- * isEmptyString('') // true
502
- * isEmptyString('a') // false
503
- * ```
504
- */
505
- export declare function isEmptyString(value: unknown): value is '';
506
- /** Determine whether a value is an empty array.
507
- *
508
- * @example
509
- * ```ts
510
- * isEmptyArray([]) // true
511
- * isEmptyArray([1]) // false
512
- * ```
513
- */
514
- export declare function isEmptyArray(value: unknown): value is readonly [];
515
- /** Determine whether a value is an empty plain object (no own string or enumerable symbol keys).
516
- *
517
- * @example
518
- * ```ts
519
- * isEmptyObject({}) // true
520
- * isEmptyObject({ a: 1 }) // false
521
- * ```
522
- */
523
- export declare function isEmptyObject(value: unknown): value is Record<string | symbol, never>;
524
- /** Determine whether a value is an empty `Map`.
525
- *
526
- * @example
527
- * ```ts
528
- * isEmptyMap(new Map()) // true
529
- * isEmptyMap(new Map([['a', 1]])) // false
530
- * ```
531
- */
532
- export declare function isEmptyMap(value: unknown): value is ReadonlyMap<never, never>;
533
- /** Determine whether a value is an empty `Set`.
534
- *
535
- * @example
536
- * ```ts
537
- * isEmptySet(new Set()) // true
538
- * isEmptySet(new Set([1])) // false
539
- * ```
540
- */
541
- export declare function isEmptySet(value: unknown): value is ReadonlySet<never>;
542
- /** Determine whether a value is a non-empty string (at least one character).
543
- *
544
- * @example
545
- * ```ts
546
- * isNonEmptyString('a') // true
547
- * isNonEmptyString('') // false
548
- * ```
549
- */
550
- export declare function isNonEmptyString(value: unknown): value is string;
551
- /** Determine whether a value is a non-empty array (at least one element).
552
- *
553
- * @example
554
- * ```ts
555
- * isNonEmptyArray([1]) // true
556
- * isNonEmptyArray([]) // false
557
- * ```
558
- */
559
- export declare function isNonEmptyArray<T = unknown>(value: unknown): value is readonly [T, ...T[]];
560
- /** Determine whether a value is a non-empty plain object (at least one own string or enumerable symbol key).
561
- *
562
- * @example
563
- * ```ts
564
- * isNonEmptyObject({ a: 1 }) // true
565
- * isNonEmptyObject({}) // false
566
- * ```
567
- */
568
- export declare function isNonEmptyObject(value: unknown): value is Record<string | symbol, unknown>;
569
- /** Determine whether a value is a non-empty `Map` (at least one entry).
570
- *
571
- * @example
572
- * ```ts
573
- * isNonEmptyMap(new Map([['a', 1]])) // true
574
- * isNonEmptyMap(new Map()) // false
575
- * ```
576
- */
577
- export declare function isNonEmptyMap<K = unknown, V = unknown>(value: unknown): value is ReadonlyMap<K, V>;
578
- /** Determine whether a value is a non-empty `Set` (at least one element).
579
- *
580
- * @example
581
- * ```ts
582
- * isNonEmptySet(new Set([1])) // true
583
- * isNonEmptySet(new Set()) // false
584
- * ```
585
- */
586
- export declare function isNonEmptySet<T = unknown>(value: unknown): value is ReadonlySet<T>;
587
- /** Determine whether a value is a function that declares zero parameters (`Function.length === 0`).
588
- *
589
- * @example
590
- * ```ts
591
- * isZeroArg(() => {}) // true
592
- * isZeroArg((a) => a) // false
593
- * ```
594
- */
595
- export declare function isZeroArg(value: unknown): value is ZeroArgFunction;
596
- /**
597
- * Determine whether a value is a native `async function`.
598
- *
599
- * @remarks
600
- * Uses `constructor.name === 'AsyncFunction'` — not `instanceof`, which is
601
- * unreliable across realms. The `?.` keeps the guard total (§14): a function
602
- * whose `constructor` was nulled yields `undefined`, never a thrown `null.name`.
603
- *
604
- * @example
605
- * ```ts
606
- * isAsyncFunction(async () => {}) // true
607
- * isAsyncFunction(() => {}) // false
608
- * ```
609
- */
610
- export declare function isAsyncFunction(value: unknown): value is AnyAsyncFunction;
611
- /** Determine whether a value is a generator function (`function*`).
612
- *
613
- * @example
614
- * ```ts
615
- * isGeneratorFunction(function* () {}) // true
616
- * isGeneratorFunction(() => {}) // false
617
- * ```
618
- */
619
- export declare function isGeneratorFunction(value: unknown): value is (...args: unknown[]) => Generator<unknown, unknown, unknown>;
620
- /** Determine whether a value is an async generator function (`async function*`).
621
- *
622
- * @example
623
- * ```ts
624
- * isAsyncGeneratorFunction(async function* () {}) // true
625
- * isAsyncGeneratorFunction(function* () {}) // false
626
- * ```
627
- */
628
- export declare function isAsyncGeneratorFunction(value: unknown): value is (...args: unknown[]) => AsyncGenerator<unknown, unknown, unknown>;
629
- /** Determine whether a value is a zero-argument async function.
630
- *
631
- * @example
632
- * ```ts
633
- * isZeroArgAsync(async () => {}) // true
634
- * isZeroArgAsync(async (a) => a) // false
635
- * ```
636
- */
637
- export declare function isZeroArgAsync(value: unknown): value is ZeroArgAsyncFunction;
638
- /** Determine whether a value is a zero-argument generator function.
639
- *
640
- * @example
641
- * ```ts
642
- * isZeroArgGenerator(function* () {}) // true
643
- * isZeroArgGenerator(function* (a) {}) // false
644
- * ```
645
- */
646
- export declare function isZeroArgGenerator(value: unknown): value is () => Generator<unknown, unknown, unknown>;
647
- /** Determine whether a value is a zero-argument async generator function.
648
- *
649
- * @example
650
- * ```ts
651
- * isZeroArgAsyncGenerator(async function* () {}) // true
652
- * isZeroArgAsyncGenerator(async function* (a) {}) // false
653
- * ```
654
- */
655
- export declare function isZeroArgAsyncGenerator(value: unknown): value is () => AsyncGenerator<unknown, unknown, unknown>;
656
- /**
657
- * Determine whether a value can be used as a `new`-target constructor.
658
- *
659
- * @remarks
660
- * Probes with `Reflect.construct(String, [], value)`: a real constructor
661
- * succeeds, while arrow functions, plain functions, and non-functions throw
662
- * and yield `false`. Never throws. Backs the `instanceOf` combinator.
663
- *
664
- * @example
665
- * ```ts
666
- * isConstructor(class X {}) // true
667
- * isConstructor(() => {}) // false
668
- * ```
669
- */
670
- export declare function isConstructor(value: unknown): value is AnyConstructor<object>;
671
- /**
672
- * Determine whether a value is a cycle-safe JSON value.
673
- *
674
- * @remarks
675
- * Total guard: never throws, returns `false` for cycles, functions, `Date`
676
- * instances, class instances, `NaN`, and `±Infinity`. Arrays and plain records
677
- * are walked with an ancestor set so recursive input fails instead of hanging.
678
- * The whole walk runs inside `attempt` (AGENTS §14): a hostile getter on a
679
- * record property, or a revoked `Proxy` anywhere in the structure, is caught
680
- * and yields `false` instead of escaping as a thrown error.
681
- *
682
- * @param value - The value to test
683
- * @returns `true` when the value has a JSON representation
684
- *
685
- * @example
686
- * ```ts
687
- * isJSONValue({ nested: [1, 'x', null] }) // true
688
- * isJSONValue(Number.NaN) // false
689
- * ```
690
- */
691
- export declare function isJSONValue(value: unknown): value is JSONValue;
692
- /**
693
- * Determine whether a value is a primitive JSON value.
694
- *
695
- * @remarks
696
- * The flat leaf of any JSON document: `null`, a string, a **finite** number, or
697
- * a boolean. Uses {@link isFiniteNumber} (not {@link isNumber}) because real JSON
698
- * carries no `NaN` / `±Infinity` — `JSON.stringify(NaN)` is `'null'`.
699
- *
700
- * The recursive {@link isJSONValue} guard is shipped and stays total with
701
- * cycle-safe walking. Dedicated `isJSONObject` / `isJSONSchema` validators and
702
- * the broad `JSONSchemaDefinition` remain omitted; compose narrower shapes with
703
- * the combinators and gate untrusted strings with `parseJSON` / `parseJSONAs`.
704
- *
705
- * @param value - The value to test
706
- * @returns `true` when `value` is `null`, a string, a finite number, or a boolean
707
- *
708
- * @example
709
- * ```ts
710
- * isJSONPrimitive(null) // true
711
- * isJSONPrimitive('hi') // true
712
- * isJSONPrimitive(42) // true
713
- * isJSONPrimitive(Number.NaN) // false — not representable in JSON
714
- * isJSONPrimitive({}) // false
715
- * ```
716
- */
717
- export declare function isJSONPrimitive(value: unknown): value is JSONPrimitive;