/** * @file The six iterator helpers that consume the iterator and return a value. * Same step order as the lazy helpers: the receiver must be an object, then * the callback is validated - and a bad callback closes the receiver before * throwing - and only then is `next` read. * Two kinds of early exit, closed differently. A callback that THREW closes * quietly, so a throwing `return` cannot mask it. A short-circuit that * succeeded (`some` found a match, `find` found its value) closes normally, * letting a throwing `return` propagate. */ /** * `Iterator.prototype.every` shim. Closes the source on the first miss. */ export declare function iteratorEveryShim(receiver: unknown, predicate: (value: T, index: number) => unknown): boolean; /** * `Iterator.prototype.find` shim. Closes the source on the first match. */ export declare function iteratorFindShim(receiver: unknown, predicate: (value: T, index: number) => unknown): T | undefined; /** * `Iterator.prototype.forEach` shim. */ export declare function iteratorForEachShim(receiver: unknown, visit: (value: T, index: number) => void): undefined; /** * `Iterator.prototype.reduce` shim. * * With no initial value the first element becomes the accumulator, and an * EMPTY iterator is a TypeError rather than undefined - the same rule * `Array.prototype.reduce` follows. */ export declare function iteratorReduceShim(receiver: unknown, reducer: (accumulator: A, value: T, index: number) => A, ...initial: [A] | []): A; /** * `Iterator.prototype.some` shim. Closes the source on the first match. */ export declare function iteratorSomeShim(receiver: unknown, predicate: (value: T, index: number) => unknown): boolean; /** * `Iterator.prototype.toArray` shim. */ export declare function iteratorToArrayShim(receiver: unknown): T[];