/// /** * Generate a unique identifier by random. * * utils.uid(10); * // => "FDaS435D2z" * * The possibility of conliction in n IDs of length L: * * p(n) ≈ n²/(2*62^L) * * @param len - Length of the generated ID */ declare function uid(len: number): string; declare function bkdrhash(s: string, n: number): number; /** * Usage: * ``` * await sleep(3000); * // continue following task * ``` */ declare function sleep(millisec: number): Promise; declare type EncodingType = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex'; declare function urlSafeBase64Encode(value: string | Buffer, encoding?: EncodingType): string; declare function urlSafeBase64Decode(value: string, encoding?: string): string; /** * @deprecated Use `random` */ declare function getRandomIntInclusive(min: number, max: number): number; /** * Return a random integer in range [min, max] * @param min range lower edge (inclusive), must be integer * @param max range higher edge (inclusive), must be integer */ declare function random(min: number, max: number): number; /** * Stringify a simple object to JSON and make the keys sorted. It can be used as key in `Map`. */ declare function orderedJsonStringify(obj: any): string; /** * Get Module Name */ declare function getModuleName(): string | undefined; /** * @description Convert an object to another case-style object recursively * @param {T} input * @param {(name:string)=>string} convertStr Specific style convert function * @returns U */ declare function convertCase(input: T, convertStr: (name: string) => string): U; /** * @description Convert an object to a kebab-case object recursively * @param {T} input * @returns U */ declare function toKebabCase(input: T): U; /** * @description Convert an object to a camel-case object recursively * @param {T} input * @returns U */ declare function toCamelCase(input: T): U; /** * @description Convert an object to a snake-case object recursively * @param {T} input * @returns U */ declare function toSnakeCase(input: T): U; declare function readFile(path: string): Promise; export declare enum TimeFormat { Second = 0, Millisecond = 1 } export declare function getTimeString(time: number, options?: { inputFormat: TimeFormat; outputFormat: TimeFormat; }): string; export { uid, bkdrhash as hash, sleep, urlSafeBase64Encode, urlSafeBase64Decode, getRandomIntInclusive, random, orderedJsonStringify, getModuleName, convertCase, toKebabCase, toCamelCase, toSnakeCase, readFile, };