/** * @file `Iterator.from` (Node 22) and `Iterator.concat` (Node 26). * `Iterator.from` has one job worth spelling out: an object that is ALREADY * an iterator inheriting from `%IteratorPrototype%` is returned untouched, * and anything else is wrapped. Wrapping something already wrapped would be * observable, because the wrapper forwards `return` and the original would * receive it twice. */ import type { IteratorRecord } from './shared.mts'; /** * A wrapper's source, with `next` captured at wrap time. * * `next` is read ONCE, when `Iterator.from` runs; `return` is looked up on * every call. test262 checks both halves of that asymmetry. */ export interface WrappedSource { iterator: object; next: unknown; } /** * True when `value` already inherits from `%IteratorPrototype%`, so * `Iterator.from` hands it back rather than wrapping it. */ export declare function inheritsFromIteratorPrototype(value: unknown): boolean; /** * `Iterator.concat` shim. * * Every argument is validated up front - each must be an object with a * callable `Symbol.iterator` - so a bad third argument throws before the first * one is walked. */ export declare function iteratorConcatShim(...sources: readonly unknown[]): IteratorObject; /** * `Iterator.from` shim. */ export declare function iteratorFromShim(source: unknown): IteratorObject; /** * The iterator record for an iterable OR an iterator. * * A string is accepted here, unlike in `flatMap`: `Iterator.from('ab')` is * specified to walk its code points. */ export declare function recordFromIterableOrIterator(source: unknown): IteratorRecord; /** * `%WrapForValidIteratorPrototype%`. * * Distinct from the iterator-helper prototype because its methods FORWARD * results rather than normalize them: `wrapper.next()` hands back exactly the * object the source returned, and `wrapper.return()` hands back exactly what * the source's `return` returned. A helper cannot do that - it has to report * its own done state - which is why `Iterator.from` gets its own shape. */ export declare const wrapForValidIteratorPrototype: object; /** * The wrapped source for a wrapper object, or a TypeError. */ export declare function wrappedTargetOf(receiver: unknown): WrappedSource;