export declare type IterableEx = Iterable & { /** * The function returns an iterator of a this container own enumerable number-keyed value [key, value] pairs. */ readonly entries: () => IterableEx>; /** * Creates a new sequence whose values are calculated by passing this sequence's elements through the given * function. */ readonly map: (func: (v: T, i: number) => R) => IterableEx; /** * Returns the first element of this sequence or `undefined` if the sequence is empty. */ readonly first: () => T | undefined; /** * The flatMap() method first maps each element using a mapping function, then flattens the result. */ readonly flatMap: (func: (v: T, i: number) => Iterable) => IterableEx; /** * Creates a new sequence whose values are the elements of this sequence which satisfy the specified predicate. */ readonly filter: (func: (v: T, i: number) => boolean) => IterableEx; /** * Creates a new sequence whose values are calculated by passing this sequence's elements through the given * function. If the function `func` returns `undefined`, the item is removed from the sequence. */ readonly filterMap: (func: (v: T, i: number) => R | undefined) => IterableEx; /** * The forEach() method executes a provided function once for each sequence element. */ readonly forEach: (func: (v: T, i: number) => void) => void; /** * Creates a slice of sequence with n elements dropped from the beginning. */ readonly drop: (n?: number) => IterableEx; /** * Creates a new sequence with all of the elements of this one, plus those of the given sequence(s). */ readonly concat: (...input: readonly (Iterable | undefined)[]) => IterableEx; /** * Creates a new sequence comprising the elements from the head of this sequence that satisfy some predicate. Once * an element is encountered that doesn't satisfy the predicate, iteration will stop. */ readonly takeWhile: (func: (v: T, i: number) => boolean) => IterableEx; /** * Creates a slice of sequence with n elements taken from the beginning. */ readonly take: (n?: number) => IterableEx; /** * This method is like find except that it returns the `Entry` of the first element predicate returns truthy for * instead of the element itself. This is useful if the sequence can contain `undefined` values. */ readonly findEntry: (func: (v: T, i: number) => boolean) => Entry | undefined; /** * Searches for the first element in the sequence satisfying a given predicate. */ readonly find: (func: (v: T, i: number) => boolean) => T | undefined; /** * Reduces collection to a value which is the accumulated result of running each element in collection thru * `func`, where each successive invocation is supplied the return value of the previous. */ readonly fold: (func: (a: A, b: T, i: number) => A, init: A) => A; /** * Reduces collection to a value which is the accumulated result of running each element in collection thru * `func`, where each successive invocation is supplied the return value of the previous. * * The first element of collection is used as the initial value. */ readonly reduce: (func: (a: T, b: T, i: number) => T) => T | undefined; /** * Returns the last element of this sequence or `undefined` if the sequence is empty. */ readonly last: () => T | undefined; /** * Checks whether at least one element in this sequence satisfies a given predicate (or, if no predicate is * specified, whether the sequence contains at least one element). */ readonly some: (func?: (v: T, i: number) => boolean) => boolean; /** * Checks whether every element in this sequence satisfies a given predicate. */ readonly every: (func: (v: T, i: number) => boolean) => boolean; /** * Creates a new sequence by combining the elements from this sequence with corresponding elements from the * specified sequence(s). */ readonly zip: (...inputs: readonly (Iterable | undefined)[]) => IterableEx; /** * Checks if all items in the sequence are equal to the items in the given sequence `b`. */ readonly isEqual: (b: Iterable | undefined, e?: (ai: T, bi: B) => boolean) => boolean; /** * Creates an array snapshot of a sequence. */ readonly toArray: () => readonly T[]; /** * Creates a new array with the same elements as this sequence, but in the opposite order. */ readonly reverse: () => readonly T[]; /** * Checks whether the sequence has no elements. */ readonly isEmpty: () => boolean; /** * Creates a new sequence with every unique element from this one appearing exactly once (i.e., with duplicates * removed). */ readonly uniq: (key?: (v: T) => unknown) => IterableEx; /** * Creates a new sequence of accumulated values. It's exclusive scan so it always returns at least one value. */ readonly scan: (func: (a: A, b: T, i: number) => A, init: A) => IterableEx; /** * Firstly, the function maps a state and each element using the `func` function, then flattens the result. */ readonly flatScan: (func: (a: A, b: T, i: number) => readonly [A, Iterable], init: A) => IterableEx; }; export declare const iterable: (createIterator: () => Iterator) => IterableEx; export declare type Entry = readonly [number, T]; export declare const ENTRY_KEY = 0; export declare const ENTRY_VALUE = 1; export declare const chain: (input: readonly T[]) => IterableEx; export declare const entries: (input: Iterable | undefined) => IterableEx>; export declare const map: (input: Iterable | undefined, func: (v: I, i: number) => T) => IterableEx; export declare const drop: (input: Iterable | undefined, n?: number) => IterableEx; export declare const flat: (input: Iterable | undefined> | undefined) => IterableEx; export declare const concat: (...input: readonly (Iterable | undefined)[]) => IterableEx; export declare const takeWhile: (input: Iterable | undefined, func: (v: T, i: number) => boolean) => IterableEx; export declare const take: (input: Iterable | undefined, n?: number) => IterableEx; export declare const findEntry: (input: Iterable | undefined, func: (v: T, i: number) => boolean) => Entry | undefined; export declare const find: (input: Iterable | undefined, func: (v: T, i: number) => boolean) => T | undefined; export declare const flatMap: (input: Iterable | undefined, func: (v: I, i: number) => Iterable) => IterableEx; export declare const optionalToArray: (v: T | undefined) => readonly T[]; export declare const filterMap: (input: Iterable | undefined, func: (v: I, i: number) => T | undefined) => IterableEx; export declare const filter: (input: Iterable | undefined, func: (v: T, i: number) => boolean) => IterableEx; export declare const generate: (func: (i: number) => T, count?: number | undefined) => IterableEx; export declare const repeat: (v: T, count?: number | undefined) => IterableEx; export declare const scan: (input: Iterable | undefined, func: (a: A, b: T, i: number) => A, init: A) => IterableEx; export declare const flatScan: (input: Iterable | undefined, func: (a: A, b: T, i: number) => readonly [A, Iterable], init: A) => IterableEx; export declare const fold: (input: Iterable | undefined, func: (a: A, b: T, i: number) => A, init: A) => A; export declare const reduce: (input: Iterable | undefined, func: (a: T, b: T, i: number) => T) => T | undefined; export declare const first: (input: Iterable | undefined) => T | undefined; export declare const last: (input: Iterable | undefined) => T | undefined; export declare const some: (input: Iterable | undefined, func?: (v: T, i: number) => boolean) => boolean; export declare const every: (input: Iterable | undefined, func: (v: T, i: number) => boolean) => boolean; export declare const forEach: (input: Iterable | undefined, func: (v: T, i: number) => void) => void; export declare const sum: (input: Iterable | undefined) => number; export declare const min: (input: Iterable | undefined) => number; export declare const max: (input: Iterable | undefined) => number; export declare const zip: (...inputs: readonly (Iterable | undefined)[]) => IterableEx; export declare const isStrictEqual: (a: unknown, b: unknown) => boolean; export declare const isEqual: (a: Iterable | undefined, b: Iterable | undefined, e?: (ai: A, bi: B) => boolean) => boolean; export declare const isArray: (v: U | readonly T[]) => v is readonly T[]; export declare const toArray: (i: Iterable | undefined) => readonly T[]; export declare const reverse: (i: Iterable | undefined) => readonly T[]; export declare const arrayReverse: (a: readonly T[]) => IterableEx; export declare const isEmpty: (i: Iterable | undefined) => boolean; export declare const join: (i: Iterable | undefined, separator: string) => string; export declare const empty: () => IterableEx; export declare const dropRight: (i: readonly T[] | undefined, n?: number) => IterableEx; export declare const uniq: (i: Iterable, key?: (v: T) => unknown) => IterableEx; //# sourceMappingURL=iterator.d.ts.map