import { Ctor, JsonObj, Nil } from "./types"; /** * isNullish * Typeguard - check a value is undefined or null */ export declare const isNil: (value: unknown) => value is Nil; /** * notNil * Typeguard - check a value is neither undefined or null * @see isNil */ export declare const notNil: (value: T | Nil) => value is T; /** * isEmpty * Logic - check a given value is considered empty * empty depends on typeof value: * - null * - undefined * - array: length = 0 * - string: length = 0 * @see isNil * @see isString * @see isArray */ export declare const isEmpty: (value: unknown) => value is Nil; /** * isObject * Typeguard - check a value is an object in the conceptual sense not the JS sense * excluding JS overlap with: * null * Arrays * Functions */ export declare const isObject: (value: T) => value is Exclude, Nil | any[] | ((...args: any) => any)>; /** * isString * TypeGuard to check a value is a string */ export declare const isString: (value: unknown) => value is string; /** * notEmptyString * Typeguard + Logic - check a value is a string with contents */ export declare const notEmptyString: (value: unknown) => value is string; /** * isArray * Typeguard - check a value is an Array */ export declare const isArray: (value: unknown) => value is unknown[]; /** * notEmptyArray * Typeguard + Logic - check a value is an Array with contents */ /** * asArray * convert a value to an array * @param items - the value to be converted * - nullish returns empty array * - single item returns array with item * - array returns array * @param guard? - optional Typeguard to filter items ensuring item types */ export declare function asArray(items: T | T[] | Nil): T[]; export declare function asArray(items: T | T[] | Nil, guard: (item: unknown) => item is U): U[]; export declare const asJsonObj: (value: unknown) => JsonObj; /** * expect * assert a value is notNil and return the value typed as such * panic otherwise * * @param value - the value to check * @param error? - custom error */ export declare function expect(value: T, error?: string | Ctor | Error): Exclude;