/** Removes all null and undefined values from an array. */ export declare function filterAbsent(arr: ReadonlyArray): ReadonlyArray>; declare const atLeastOneSymbol: unique symbol; export type AtLeastOne = ReadonlyArray & { readonly [atLeastOneSymbol]: undefined; }; export declare function atLeastOne(arr: ReadonlyArray): AtLeastOne; declare const atLeastTwoSymbol: unique symbol; export type AtLeastTwo = AtLeastOne & { readonly [atLeastTwoSymbol]: undefined; }; export declare function atLeastTwo(arr: ReadonlyArray): AtLeastTwo; /** Returns a shuffled version of the input array. */ export declare function shuffled(arr: ReadonlyArray): ReadonlyArray; /** * Returns the only element in an iterable, throwing if the iterable has more or * fewer elemets. */ export declare function onlyElement(iter: Iterable): V; /** Returns the first element from an iterable, if any. */ export declare function firstElement(iter: Iterable): V | undefined; /** * Returns all consecutive pairs of elements. The returned iterable as the same * number of elements as the input one. */ export declare function consecutiveElementPairs(iter: Iterable, last?: V): Iterable<[V, V]>; /** Returns true if the array is sorted in ascending order */ export declare function isSorted(arr: ReadonlyArray, comp?: (v1: V, v2: V) => number): boolean; /** * Creates a range from `from` inclusive (defaulting to 0) to `to` exclusive. */ export declare function range(to: number, from?: number): ReadonlyArray; /** Base multimap class. */ declare abstract class Multimap> implements Iterable<[K, V]> { private _size; protected readonly data: Map; protected abstract emptyValues(): C; protected abstract addValues(col: C, vals: Iterable): void; protected abstract valueCount(col: C): number; get size(): number; add(key: K, val: V): void; addAll(key: K, vals: Iterable): void; has(key: K): boolean; get(key: K): Readonly; delete(key: K): void; clear(): void; toMap(): ReadonlyMap>; [Symbol.iterator](): Iterator<[K, V]>; } /** Array-backed multimap. */ export declare class ArrayMultimap extends Multimap { protected emptyValues(): V[]; protected valueCount(col: V[]): number; protected addValues(col: V[], vals: Iterable): void; } /** Set-backed multimap. */ export declare class SetMultimap extends Multimap> { protected emptyValues(): Set; protected valueCount(col: Set): number; protected addValues(col: Set, vals: Iterable): void; } /** * Non-negative counter. Keys are iterated in the order in which they were last * added (i.e. reached a positive count). */ export declare class Multiset implements Iterable { private readonly data; private _size; /** * Updates a key's count, updating it by the given value. If the resulting * count is non-positive, the key will be removed. */ add(key: K, count?: number): void; /** * Adds each key in the input iterable. This method is optimized for the case * when the input is also a multiset. */ addAll(keys: Iterable): void; /** Returns the count of occurrences of a given value, or 0 if not found. */ get(key: K): number; /** * Returns the total of (non-distinct) elements in the multiset. Use * `.toMap().size` for the total number of distinct elements. */ get size(): number; clear(): void; /** Returns a map of counts. */ toMap(): ReadonlyMap; [Symbol.iterator](): Iterator; /** Returns an array of entries in descending count order. */ descending(): [K, number][]; /** * Returns the entry with the highest count. If multiple entries have the * highest count, the one with the first latest creation will be returned. */ mostCommon(): [K, number] | undefined; } /** Maps over an `Iterable`. */ export declare function mapIterable(iter: Iterable, fn: (val: V, ix: number) => W): Iterable; /** Maps over an `AsyncIterable`. */ export declare function mapAsyncIterable(iter: AsyncIterable, fn: (val: V, ix: number) => W): AsyncIterable; /** Checks whether the argument is an `AsyncIterable`. */ export declare function isAsyncIterable(arg: unknown): arg is AsyncIterable; /** Converts an `Iterable` to an `AsyncIterable`. */ export declare function toAsyncIterable(arr: Iterable): AsyncIterable; /** Converts an `AsyncIterable` to an array. */ export declare function fromAsyncIterable(iter: AsyncIterable): Promise>; export {};