@iicoding/utils
Version:
Browser 端 - 类型判断 - 类似 koa 的异步compose - sleep - 扩展对象属性 - 扩展 storage 对象功能
17 lines (16 loc) • 1.26 kB
TypeScript
export type ComplexResult = 'object' | 'function' | 'error' | 'date' | 'regExp' | 'array' | 'blob' | 'promise' | 'buffer';
export declare const getComplex: (source: unknown) => ComplexResult | undefined;
export declare const getType: (source: unknown) => string | undefined;
export declare const isNumber: (num: unknown) => num is number;
export declare const isString: (str: unknown) => str is string;
export declare const isSymbol: (sym: unknown) => sym is symbol;
export declare const isBigInteger: (num: unknown) => num is bigint;
export declare const isBoolean: (bool: unknown) => bool is boolean;
export declare const isObject: <V, R = Record<string, any>>(obj: unknown) => obj is R | Record<string, V>;
export declare const isBlob: (blob: unknown) => blob is Blob;
export declare const isDate: (date: unknown) => date is Date;
export declare const isArrayBuffer: (buffer: unknown) => buffer is ArrayBuffer;
export declare const isHTMLElement: (element: unknown) => element is HTMLElement;
export declare const isPlainObject: <V, R = Record<string, any>>(obj: unknown) => obj is R | Record<string, V>;
export declare const isFunction: (func: unknown) => func is Function;
export declare const isPromise: <R = any>(source: unknown) => source is Promise<R>;