ntils
Version:
一个 Node & Browser 工具函数集
49 lines (48 loc) • 3.13 kB
TypeScript
export declare function noop(): void;
export declare function toString(value: any): any;
export declare function getType(value: any): string;
export declare function isNull(value: any): value is null;
export declare function isFunction(value: any): value is Function;
export declare function isAsyncFunction(value: any): value is Function;
export declare function isGeneratorFunction(value: any): value is GeneratorFunction;
export declare function isString(value: any): value is string;
export declare function isNumber(value: any): value is number;
export declare function isBoolean(value: any): value is boolean;
export declare function isElement(value: any): value is Element;
export declare function isText(value: any): value is Text;
export declare function isObject(value: any): value is object;
export declare function isArray(value: any): value is any[];
export declare function isTypedArray(value: any): boolean;
export declare function isDate(value: any): value is Date;
export declare function isRegExp(value: any): value is RegExp;
export declare function toArray<T = any>(array: any): T[];
export declare function toDate(value: any): Date;
export declare function replace(str: string, from: string, to: string): string;
export declare function formatDate(value: Date | number | string, format: string, options?: {
utc?: boolean;
translate?: Record<string, string>;
}): string;
export declare function each(list: any, handler: (key: string | number, value: any) => any, scope: any): any;
export declare function copy(src: any, dst?: any, ignores?: string[]): any;
export declare function clone(src: any, ignores?: string[]): any;
export declare function getPrototypeOf(obj: any): any;
export declare function setPrototypeOf(obj: any, proto: any): any;
export declare function create(proto: any): any;
export declare function mix(dst: any, src: any, ignores?: string[], mode?: 0 | 1 | 2 | 3 | 4, ignoreNull?: boolean): any;
export declare function final(obj: any, name: string, value: any): void;
export declare function deepEqual(a: any, b: any): boolean;
export declare function fromTo(from: number, to: number, handler: (value?: number) => void, step?: number): void;
export declare function newGuid(): string;
export declare function setByPath(obj: any, path: string | string[], value: any): void;
export declare function getByPath(obj: any, path: string | string[], filter?: (value?: any, key?: string, obj?: any) => boolean): any;
export declare function getFunctionArgumentNames(fn: Function): string[];
export declare const FUNC_REGEXP: RegExp;
export declare function isFunctionString(str: string): boolean;
export declare function toFunction(str: string): Function;
export declare function short(str: string, maxLength: number): string;
export declare function firstUpper(str: string): string;
export declare function escapeRegExp(str: string): string;
export declare function toCamelCase(str: string, mode: 1 | 0): string;
export declare function toSplitCase(str: string): string;
export declare function filterHTML(html: string): string;
export declare function parseHTML(str: string): ChildNode[];