/** * Returns an array of numbers from start (inclusive) to end (exclusive), going * up by one at a time. Useful for iterating through numbers in a loop or lambda * function. E.g. `range(2, 6)` gives `[2, 3, 4, 5]`. * @param start The starting number (inclusive). * @param end The ending number (exclusive). */ export declare function range(start: number, end: number): number[]; /** * Returns an array that contains {@link something} repeated a certain * {@link amount} of times. * @param something The value to appear several times in the array. * @param amount The number of times to include said value. */ export declare function repeat(something: T, amount: number): T[]; type EqualsFunc = (a: T, b: T) => boolean; /** * Returns the same array, with the duplicates removed. The given * {@link equalsFunc} is used to determine if two items should be considered * duplicates. * @param array The array. * @param equalsFunc The function to determine if two items should be considered * duplicates. */ export declare function unique(array: readonly string[]): string[]; export declare function unique(array: readonly number[]): number[]; export declare function unique(array: readonly T[], equalsFunc?: EqualsFunc): T[]; /** * Returns true if every element in the array is unique, according to the given * {@link equalsFunc}, which is used to determine if two items should be * considered duplicates. * @param array The array. * @param equalsFunc The function to determine if two items should be considered * duplicates. */ export declare function areUnique(array: readonly string[]): boolean; export declare function areUnique(array: readonly number[]): boolean; export declare function areUnique(array: readonly T[], equalsFunc?: EqualsFunc): boolean; /** * Returns true if the two arrays contain the same elements. The order of the * arrays are irrelevant, and duplicate values have no effect on the outcome. * @param a The first array. * @param b The second array. * @param equalsFunc The function to determine if two items should be considered * equal. */ export declare function arraysMatch(a: readonly string[], b: readonly string[]): boolean; export declare function arraysMatch(a: readonly number[], b: readonly number[]): boolean; export declare function arraysMatch(a: readonly T[], b: readonly T[], equalsFunc?: EqualsFunc): boolean; /** * Removes an item from the given array if it matches the predicate. Modifies * the array in-place (does not create new array). Returns true if the array was * modified. * @param array The array to remove items from. * @param predicate A function that determines if an item should be removed. */ export declare function removeIf(array: T[], predicate: (a: T) => boolean): boolean; type Groups = { group: Group; items: Item[]; }[]; /** * Groups the given items using the given group selector. * @param items The items to group. * @param groupSelector A function which selects the string/number to group by. */ export declare function groupBy(items: readonly Item[], groupSelector: (item: Item) => Group): Groups; /** * Runs {@link isSameGroup} on each consecutive pair of {@link items}, and when * it returns true, groups them together. Returns the array of groups. * @param items The items to group. * @param isSameGroup A function which returns true if two items should be grouped together. */ export declare function groupConsecutive(items: readonly Item[], isSameGroup: (a: Item, b: Item) => boolean): Item[][]; /** * Checks the two arrays for matches and differences. * @param input The two arrays to compare, key to compare them by, and callbacks * to run in each situation. */ export declare function compareArrays(input: { a: readonly A[]; b: readonly B[]; aKeyFunc: (a: A) => Key; bKeyFunc: (b: B) => Key; onMatch?: (a: A, b: B) => void; onMissingFromA?: (b: B) => void; onMissingFromB?: (a: A) => void; }): void; export {};