Skip to content

Architecture

Vitaly Tomilov edited this page Nov 18, 2021 · 20 revisions

This library has a very simple structure and architecture.

Each operator here is simply a function that takes parameters, and returns another function that takes the source iterable, applies the transformation to it, and returns a new iterable. This means you can execute any operator independently, outside the pipeline:

const i1 = concat(3, 4)([1, 2]);
const i2 = count()(i1);

console.log([...i1]); //=> [1, 2, 3, 4]
console.log([...i2]); //=> [4]

This however doesn't mean you should be using it this way, because function pipe adds two important things:

  • Strict type control, which you will lose, and have to resolve to any, which is quite bad.
  • Extends the result with property first, to simplify use of one-value iterables, plus method catch, so you can chain error handlers.
Clone this wiki locally