Functional Streams
Provides four native Node streams that mirror the behaviour of basic FP array manipulations. As they extend
directly from Node native streams, they can be pipe
d and emit events as you are used to. No runtime dependencies, typescript definitions included.
;
Map
const mapStream = n + 2;
Filter
const filterStream = n % 2 === 0;
Reduce
Provides a then
method so this can be used in a promise-like fashion to get the end result.
const reduceStream = sum + n 0; reduceStream;reduceStream;reduceStream;reduceStream;reduceStream; reduceStream;
Batch
const batchStream = 3; batchStream;batchStream;batchStream;batchStream;batchStream; batchStream; // [0, 1, 2];batchStream; // [3, 4];