pure-stream

Collection of functional utilities for working with object streams

Usage no npm install needed!

<script type="module">
  import pureStream from 'https://cdn.skypack.dev/pure-stream';
</script>

README

pure-stream

Collection of utilities for working with object streams

npm

About

This library uses a new class PureStream to implement object streams in an easy and logical way.

  • PureStreams are ended when an error occurs
  • pipe-ing propagates errors from source to destination(s)
  • No events. Data is collected with each and ended with done

PureStreams are lazy, they won't begin reading data until .done is called.

Install

$ npm install pure-stream
# or
$ yarn add pure-stream

Quick-Start

import {from, map} from 'pure-stream';

from([1, 2, 3])
.pipe(map((value) => value * 2))
.each((value) => {
  console.log(value);
  // Output:
  // 2
  // 4
  // 6
})
.done((err) => {
  if (err) console.log('Error:', err);
  else console.log('Success');
});

Usage