Pull Overview
Pull Lines are bases on native ECMAScript Iterables:
interface Iterable<T> { [Symbol.iterator](): Iterator<T>;}
interface Iterator<T> { next(): IteratorResult<T>; return?(): void;}
interface IteratorResult<T> { value: T; done: boolean;}Pull is the most used type of pipelines. A Pull Line is re-usable if its source is re-iterable.
Terms in releation to Pull Lines:
iterable-- an object implementing the Iterable protocol.operation-- a function taking anIterableof source items and returning anIterableof result items.pipeline-- an ordered sequence (array) ofoperations.source-- anIterablewhich items will be processed. Many native objects areIterableout of the box: arrays, maps, sets, strings.target-- a function for extracting the result out of pipeline. Takes anIterableand returns some value. Many native functions behave this way:Array.from(),new Map(),Object.fromEntries(), etc.Targetsprovided byUndercutare mostly wrappers around those native functions/constructors for convenience. Feel free to use the originals.
type PullOperation = <T, R>(iterable: Iterable<T>) => Iterable<R>;
type PullPipeline = Array<PullOperation>;
type PullTarget = <T, R>(iterable: Iterable<T>) => R;