import { NumericRange, Thunk, Class } from "@valuer/types"; import { Inclusiveness } from "./in-range-with-inclusiveness"; declare type KeyOf = { /** * Whether the key is a key of the composite value * @param key Key of the composite value */ (key: keyof Value): boolean; /** * Whether the key is a key of the composite value * @param key Property key */ (key: PropertyKey): boolean; /** * Whether the path can be found in the value * @param keys Deep path */ (keys: PropertyKey[]): boolean; /** * Whether the path can be found in the value * @param keys Abbreviated deep path * @param separator (defaults to `"."`) Path level separator; useful when there is a `"."` in key */ (keys: string, separator?: string): boolean; }; export declare namespace is { type PrimitiveNonVoid = boolean | string | number | symbol; type CompositeNonVoid = NonNullable; type NonVoid = PrimitiveNonVoid | CompositeNonVoid; type Void = null | undefined; type Voidable = Type | Void; type Primitive = Voidable; type Composite = object | null; /** * Get is-of-type thunk * @param types One or more JS-type(s) */ const ofType: (...types: ("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function")[]) => (value: any) => boolean; /** * Get is-an-instance-of thunk * @param classes One or more class */ const instanceOf: (...classes: Class[]) => (value: any) => boolean; /** * Get is-a-direct-instance-of thunk * @param classes One or more class */ const directInstanceOf: (...classes: Class[]) => (value: any) => boolean; /** * Get heuristic type checker * @param typeLikeArgs Kind-agnostiс type-like arguments * @example * is.ofType("string"), is.ofType(String) */ const a: (...typeLikeArgs: ("string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | Class)[]) => (value: any) => boolean; /** Whether the value is of type "string" */ const _string: (value: any) => value is string; /** Whether the value is of type "number" */ const _number: (value: any) => value is number; /** Whether the value is of type "boolean" */ const _boolean: (value: any) => value is boolean; /** Whether the value is of type "symbol" */ const _symbol: (value: any) => value is symbol; /** Whether the value is of type "function" */ const _function: (value: any) => value is Function; /** Whether the value is of type "object" */ const _object: (value: any) => value is object | null; /** Whether the value is `undefined` */ const _undefined: (value: any) => value is undefined; /** Whether the value is `null` */ const _null: (value: any) => value is null; /** Whether the value is a void */ const _void: (value: any) => value is null | undefined; /** Whether the value is not a void */ const _nonVoid: (value: any) => value is NonVoid; /** Whether the value is of type "object", but not `null` */ const _objectNonNull: (value: any) => value is object; /** Whether the value is a primitive */ const _primitive: (value: any) => value is Voidable; /** Whether the value is a primitive and is not a void */ const _nonVoidPrimitive: (value: any) => value is PrimitiveNonVoid; /** Whether the value is composite */ const _composite: (value: any) => value is object | null; /** Whether the value is composite and is not a void */ const _nonVoidComposite: (value: any) => value is object; /** Get is-not-NaN thunk */ const numeric: () => import("@valuer/types").Factory; /** * Get is-in-range thunk * @param range The range * @param inclusively (defaults to `true`) Whether to count boundary match */ const inRange: (range: number[], inclusively?: Inclusiveness) => import("@valuer/types").Factory; /** Get is-not-an-integer thunk */ const float: () => import("@valuer/types").Factory; /** * Get is-an-integer thunk * @param parity (optional) Required parity of an integer */ const integer: (parity?: "even" | "odd" | undefined) => import("@valuer/types").Factory; /** * Get is-a-natural-number thunk * @param zero (defaults to `true`) Whether zero is considered a natural number */ const natural: (zero?: boolean) => import("@valuer/types").Factory; /** * Get is-divisible-by thunk * @param divisor Divisor */ const divisibleBy: (divisor: number) => import("@valuer/types").Factory; /** * Get is-factor-of thunk * @param dividend Dividend */ const factorOf: (dividend: number) => import("@valuer/types").Factory; /** * Get is-a-boolean thunk * @param expected (optional) Expected boolean identity of the value */ const boolean: (expected?: boolean | undefined) => import("@valuer/types").Factory; /** * Get is-a-string thunk */ const string: ({ startsWith, endsWith, includes, matches }?: Partial<{ startsWith: string; endsWith: string; includes: string; matches: string | RegExp; }>) => import("@valuer/types").Factory; /** Get is-iterable thunk */ const iterable: () => (value: any) => value is Iterable; /** * Get is-an-array thunk * @param length Length of a valid array * @param valid Validity check for each element of the array */ const array: (length?: number | undefined, valid?: import("@valuer/types").Factory | undefined) => (array: any) => array is T[]; /** Get is-circular thunk */ const circular: () => (object: object) => boolean; /** Get is-convertible thunk */ const convertible: () => (value: any) => boolean; /** * Get is-key-of-object thunk * @param value Source object */ const keyOf: (value: Value) => KeyOf; /** * Get is-equal-to thunk * @param operand Operand */ const equalTo: (operand: Operand) => (input: Input) => input is Operand & Input; /** Get is-a-length-range thunk */ const lengthRange: () => (numbers: number[]) => numbers is NumericRange; /** * Whether the value is a valid string length range * @deprecated Use `is.lengthRange()(numbers)` instead */ const _lengthRange: Thunk; /** * Get is-in-array thunk * @param array Array */ const inArray: (array: T[]) => (value: any) => value is T; /** Unconstrainted thunk */ const _any: (value: any) => value is Anything; } export {};