UNPKG

meows

Version:
58 lines (57 loc) 2.03 kB
import { cond } from './index'; /** * Class of static boolean functions for finding whether a value is NOT an * empty instance of a type. */ export declare class notEmpty { static arr: (x: any) => boolean; static obj: (x: any) => boolean; static str: (x: any) => boolean; static map: (x: any) => boolean; } /** * Class of static boolean functions for finding whether a value is an empty * instance of a type. */ export declare class isEmpty { static arr: (x: any) => boolean; static obj: (x: any) => boolean; static str: (x: any) => boolean; static map: (x: any) => boolean; } /** * Class of static boolean functions for determining types and non-canonical * subtypes in JavaScript, such as natural or signable numbers. */ export declare class isType { /** All numbers except for `NaN` and `Infinity`. */ static num: (x: any) => boolean; /** Checks if natural number, including zero. */ static nat: (x: any) => boolean; static int: (number: number) => boolean; static str: (x: any) => boolean; /** Check if function. */ static fn: (x: any) => boolean; /** Any signable number including `0` and `Infinity`, but excluding `NaN`. */ static signable: (x: any) => boolean; static err: (x: any) => boolean; /** Checks if value is negative, but excludes `0` and `Infinity`. */ static neg: (x: any) => boolean; static map: (x: any) => boolean; } /** * Returns the type of an unknown value as a lower-cased string. Type 'number' * is differentiated from 'nan' and 'infinity' because most numerical functions * don't expect them. * * @example * typeName(new Map) // => 'map' * typeName(null) // => 'null' * typeName([]) // => 'array' * typeName({}) // => 'object' * typeName(/\s+/) // => 'regexp' * typeName(NaN) // => 'nan' * typeName(-1/0) // => 'infinity' */ export declare function typeName(x: any): string; export declare const assert: (item: any, tests: cond[], callback?: Function) => void;