export declare function initArray(length: number, makeElement: (i: number) => T): T[]; export declare function mapValues(map: Map, valueMapper: (value: V1) => V2): Map; export declare function mapDefined(arr: Iterable, mapper: (t: T) => U | undefined): U[]; export declare function mapDefinedAsync(arr: Iterable, mapper: (t: T) => Promise): Promise; export declare function sort(values: Iterable, comparer?: (a: T, b: T) => number): T[]; export declare function join(values: Iterable, joiner?: string): string; /** Returns [values that cb returned undefined for, defined results of cb]. */ export declare function split(inputs: readonly T[], cb: (t: T) => U | undefined): [readonly T[], readonly U[]]; /** * Appends a range of value to an array, returning the array. * * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array * is created if `value` was appended. * @param from The values to append to the array. If `from` is `undefined`, nothing is * appended. If an element of `from` is `undefined`, that element is not appended. * @param start The offset in `from` at which to start copying values. * @param end The offset in `from` at which to stop copying values (non-inclusive). */ export declare function addRange(to: T[], from: readonly T[] | undefined, start?: number, end?: number): T[]; export declare function addRange(to: T[] | undefined, from: readonly T[] | undefined, start?: number, end?: number): T[] | undefined; /** * Appends a value to an array, returning the array. * * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array * is created if `value` was appended. * @param value The value to append to the array. If `value` is `undefined`, nothing is * appended. */ export declare function append[number] | undefined>(to: TArray, value: TValue): [undefined, undefined] extends [TArray, TValue] ? TArray : NonNullable[number][]; export declare function append(to: T[], value: T | undefined): T[]; export declare function append(to: T[] | undefined, value: T): T[]; export declare function append(to: T[] | undefined, value: T | undefined): T[] | undefined; /** * Tests whether a value is an array. */ export declare function isArray(value: any): value is readonly {}[]; /** * Maps an array. The mapped value is spread into the result. * * @param array The array to map. * @param mapfn The callback used to map the result into one or more values. */ export declare function flatMap(array: readonly T[] | undefined, mapfn: (x: T, i: number) => readonly U[]): readonly U[]; export declare function unique(arr: Iterable): T[]; export declare function min(array: readonly [T, ...(T | undefined)[]]): T; export declare function min(array: readonly T[], compare?: (a: T, b: T) => number): T | undefined; export declare function max(array: readonly [T, ...(T | undefined)[]]): T; export declare function max(array: readonly T[], compare?: (a: T, b: T) => number): T | undefined; export declare function compact(array: readonly (T | undefined)[]): T[]; export declare function symmetricDifference(a: Set, b: Set): Set;