import { IEnumerable, IEnumerableFactory } from '../../types'; export function applyPipe( factory: IEnumerableFactory, src: Iterable, action: (item: TSource, index: number) => void ): IEnumerable { function* generator(): Generator { let i = 0; for (const item of src) { action(item, i); yield item; i++; } } return factory.createBasicEnumerable(generator); }