pure-stream

2.1.0 • Public • Published

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

Package Sidebar

Install

npm i pure-stream

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

37 kB

Total Files

47

Last publish

Collaborators

  • trs