/** Union of types that are primitive values or can be converted to primitive values */ export type Value = string | number | bigint | boolean | Stringer | null | undefined; export type CrudeValueExtension> = { value: V; }; export declare const isCrudeValueExtension: >(value: unknown) => value is CrudeValueExtension; /** * ValueExtension is a utility class that can be extended in order to implement objects * that pseudo-extend a primitive value with additional functionality. */ export declare class ValueExtension> { /** The underlying primitive value */ protected readonly value: V; constructor(value: V); /** Overrides the JS default valueOf() function to return the primitive value. */ valueOf(): V; /** toJSON ensures that only the primitive value gets encoded during JSON * stringification. */ toJSON(): V; /** @returns a string representation of the item. */ toString(): string; } /** * Stringer is a type that implements a toString() method in order to return a string * representation of itself. */ export interface Stringer { /** @returns a string representation of the item. */ toString: () => string; } /** @returns true if the value implements primitive.Stringer, otherwise returns false. */ export declare const isStringer: (value: unknown) => boolean; /** * Hashable is a duck-typed protocol for class instances that can produce a stable, * canonical string representation of themselves. Implementers commit to: (1) the * returned string uniquely identifies the value's logical content, and (2) two * instances representing the same logical value return equal strings. * * Used by cache-key derivation paths (e.g. flux queryCache) so non-primitive query * fields hash to a stable identifier rather than relying on enumerable own-property * iteration, which is fragile for class instances. */ export interface Hashable { /** @returns a stable, canonical string representation of the value. */ hash: () => string; } /** @returns true if the value implements primitive.Hashable, otherwise returns false. */ export declare const isHashable: (value: unknown) => value is Hashable; /** * Type representing zero values for each primitive type */ export type ZeroValue = "" | 0 | 0n | false | null | undefined; /** * Type representing non-zero values for each primitive type */ export type NonZeroValue = Exclude; /** * @returns true if the given primitive is the zero value for its type. * For strings value == "" * For numbers value == 0 * For bigints value == 0n * For booleans value == false * For objects value == null * For undefined returns true */ export declare const isZero: (value: V) => value is V & ZeroValue; /** * Type predicate function that narrows to non-zero values */ export declare const isNonZero: (value: V) => value is V & NonZeroValue; /** * @returns true if the given value is a JavaScript primitive: `null`, `undefined`, * or a value whose `typeof` is not `"object"` or `"function"`. Returns false for * objects (including arrays), functions, and class instances. * * Complements {@link isZero} and {@link isNonZero}, which check for the zero value * of a known primitive type. Use `is` when you have an `unknown` value and want to * decide whether to render it inline vs. recurse into it. */ export declare const is: (value: unknown) => boolean; //# sourceMappingURL=primitive.d.ts.map