LazyPipe - lazy evaluator pipeline

Tags deno doc License: MIT

Simple lazy evaluation of value piping. Create the logic before and compute the value only when needed.

Examples

const lazyValue = new Lazy(veryBigArray)
    .pipe((self) => self.map((x) => 2 * x))
    .pipe((self) => self.toReversed())
    .pipe((self) => self.toSorted())
    .pipe((self) => self.reduce((acc, curr) => acc - curr, 0))

if (rareCondition) {
    console.log(lazyValue.value)
}