/** @module utils */ /** * Delays for a specified amount of time. * * @param ms - The number of milliseconds to delay for. * @returns A promise that resolves after the delay. */ export declare function timeout(ms: number): Promise; /** * Comparison function for sorting in descending order. * * @param a - The first value to compare. * @param b - The second value to compare. * @returns -1 if a > b, 1 if b > a, 0 otherwise. */ export declare function sortToLower(a: any, b: any): number; /** * Comparison function for sorting in ascending order. * * @param a - The first value to compare. * @param b - The second value to compare. * @returns 1 if a > b, -1 if b > a, 0 otherwise. */ export declare function sortToHigher(a: any, b: any): number; /** * Pads a value with leading zeros until it reaches a specified length. * * @param val - The value to pad. * @param length - The desired length of the padded value. * @returns The padded value as a string. */ export declare function padZero(val: any, length?: number): string; export declare const ALPHABET: string; export declare const ALPHABET_LENGTH: number; /** * Generates a random token of a specified length. * * @param length - The desired length of the token. * @returns A random token. */ export declare function randomToken(length?: number): string; /** * Creates an array of whole numbers in a specified range. * * @param start - The start of the range. * @param end - The end of the range (exclusive). * @param step - The step size between values, defaults to 1. * @returns The generated array. */ export declare function range(start: number, end: number, step?: number): number[]; /** * Shuffles an array and returns it. * Does not modify the original array. * * @param arr - The array to shuffle. * @returns The shuffled array. */ export declare function shuffle(arr: T[]): T[]; /** * Selects a random element from an array, or returns null if the array is * empty. * * @param arr - The array to select from. * @returns A random element from the array, or null. */ export declare function randomEl(arr: T[]): T | null; /** * Checks how closely a search string matches a value, and returns a score * representing the match quality. * * @param search - The search string. * @param val - The value to check for a match. * @returns 0 if no match, 1+ if there was a match (lower is better). */ export declare function searchScore(search: string, val: string): number; /** * Calculates the sum of all numbers in an array. * * @param ar - The array of numbers to sum. * @returns The sum of all numbers in the array. */ export declare function sum(ar: number[]): number; //# sourceMappingURL=utils.d.ts.map