/** * @file The five iterator helpers that return another iterator. * The step order is fixed and observable, and it is not the order that reads * naturally: * * 1. The receiver must be an object. * 2. The argument is validated or coerced - and a FAILURE here still closes the * receiver, because the source was handed over the moment the method was * called. * 3. Only then is `next` read. So `iter.map()` with no argument closes `iter` * and throws without ever reading `iter.next`, and a `take` limit whose * `valueOf` throws closes it too. A callback that throws mid-iteration * closes the source QUIETLY: if the source's `return` also throws, the * callback's error is the one that escapes. */ import type { IteratorRecord } from './shared.mts'; /** * Turn a `flatMap` callback result into an iterator record. * * A string is rejected on purpose: it is iterable, and flattening it character * by character is the mistake the spec forbids by requiring an object. */ export declare function innerRecordOf(mapped: unknown): IteratorRecord; /** * `Iterator.prototype.drop` shim. The skipping happens on the first `next`, not * at construction, so building the helper consumes nothing. */ export declare function iteratorDropShim(receiver: unknown, limit: unknown): IteratorObject; /** * `Iterator.prototype.filter` shim. */ export declare function iteratorFilterShim(receiver: unknown, predicate: (value: T, index: number) => unknown): IteratorObject; /** * `Iterator.prototype.flatMap` shim. */ export declare function iteratorFlatMapShim(receiver: unknown, mapper: (value: T, index: number) => Iterable | Iterator): IteratorObject; /** * `Iterator.prototype.map` shim. */ export declare function iteratorMapShim(receiver: unknown, mapper: (value: T, index: number) => U): IteratorObject; /** * `Iterator.prototype.take` shim. Closes the source as soon as the count runs * out, rather than waiting to be asked again. */ export declare function iteratorTakeShim(receiver: unknown, limit: unknown): IteratorObject; /** * The spec's limit coercion for `take` and `drop`. * * ToNumber first, so a numeric string works; NaN is a RangeError rather than a * silent zero, and so is a negative limit. Infinity is preserved. */ export declare function limitOf(value: unknown): number;