UNPKG

alwz

Version:

Extendable library for typecasting

127 lines 3.85 kB
import { type Guard } from './models/Is.js'; export declare const integers: Record<"long" | "short" | "byte" | "int" | "ubyte" | "ushort" | "uint" | "ulong", Guard<number>>; export declare const floats: Record<"double", Guard<number>>; /** @module is * @description guard functions (pattern matching check) */ declare const _default: { /** @name integers * @description byte, short, int, long * @example * is.int(NaN) // false * is.long(Infinity) // false * is.uint(-1) // false * is.uint(1) // true * is.uint(1.5) // false * @memberof is.number */ /** @name floats * @description double * @example * is.double(NaN) // false * is.double(Infinity) // false * is.double(1.5) // true * @memberof is.number */ /** @function bigint * @memberof is */ bigint: (i?: unknown) => i is bigint; /** @function string * @memberof is */ string: (i?: unknown) => i is string; /** @function symbol * @memberof is */ symbol: (i?: unknown) => i is symbol; /** @function function * @memberof is */ function: (i?: unknown) => i is Function; /** @function object * @description any object (null excluded) * @example * is.object(null) // false * is.object({}) // true * @memberof is */ object: (i?: unknown) => i is object; /** @function Error * @memberof is */ Error: (i?: unknown) => i is Error; /** @function Array * @example * is.Array({}) // false * is.Array([]) // true * @memberof is */ Array: (arg: any) => arg is any[]; /** @function Date * @memberof is */ Date: (i?: unknown) => i is Date; /** @function RegExp * @memberof is */ RegExp: (i?: unknown) => i is RegExp; /** @function Promise * @memberof is */ Promise: (i?: unknown) => i is Promise<unknown>; /** @function Set * @memberof is */ Set: (i?: unknown) => i is Set<unknown>; /** @function WeakSet * @memberof is */ WeakSet: (i?: unknown) => i is WeakSet<any>; /** @function Map * @memberof is */ Map: (i?: unknown) => i is Map<unknown, unknown>; /** @function WeakMap * @memberof is */ WeakMap: (i?: unknown) => i is WeakMap<any, unknown>; /** @function Iterable * @description can be iterated * @example * is.Iterable(new Map()); // true * is.Iterable([]); // true * is.Iterable({}); // false * @memberof is */ Iterable: (i?: unknown) => i is Iterable<unknown>; double: Guard<number>; long: Guard<number>; short: Guard<number>; byte: Guard<number>; int: Guard<number>; ubyte: Guard<number>; ushort: Guard<number>; uint: Guard<number>; ulong: Guard<number>; /** @function undefined * @memberof is */ undefined: (i?: unknown) => i is undefined; /** @function null * @memberof is */ null: (i?: unknown) => i is null; /** @function void * @description undefined or null * @example * is.void(null) // true * is.void(0) // false * @memberof is */ void: (i?: unknown) => i is null | undefined; /** @function value * @description any value except undefined or null * @example * is.value(null) // false * is.value(0) // true * @memberof is */ value: (i?: unknown) => i is unknown; /** @function boolean * @example * is.boolean(1) // false * is.boolean(true) // true * @memberof is */ boolean: (i?: unknown) => i is boolean; /** * @function number * @example * is.number(NaN) // true * is.number(Infinity) // true * is.number(1) // true * is.number('1') // false * @memberof is */ number: (i?: unknown) => i is number; }; export default _default; //# sourceMappingURL=is.d.ts.map