import { IterableX } from '../../iterable/iterablex.js'; import { ScanIterable } from '../../iterable/operators/scan.js'; import { ScanOptions } from '../../iterable/operators/scanoptions.js'; /** * @ignore */ export function scanProto(this: IterableX, options: ScanOptions): IterableX; export function scanProto( this: IterableX, accumulator: (accumulator: R, current: T, index: number) => R, seed?: R ): IterableX; export function scanProto( this: IterableX, optionsOrAccumulator: ScanOptions | ((accumulator: R, current: T, index: number) => R), seed?: R ): IterableX { return new ScanIterable( this, // eslint-disable-next-line no-nested-ternary typeof optionsOrAccumulator === 'function' ? arguments.length > 1 ? // prettier-ignore { 'callback': optionsOrAccumulator, 'seed': seed } : // prettier-ignore { 'callback': optionsOrAccumulator } : optionsOrAccumulator ); } IterableX.prototype.scan = scanProto; declare module '../../iterable/iterablex' { interface IterableX { scan: typeof scanProto; } }