reduxer

0.4.1 • Public • Published

reduxer

NPM

reduxer is a stream api that works like redux.

example

var redux = require('reduxer')
 
var counter = redux((state=0, chunk) => {
  switch (chunk) {
  case 'INCREMENT':
    return state + 1
  case 'DECREMENT':
    return state - 1
  default:
    return state
  }
})
 
counter.on('data', (data) => 
  console.log(data)
)
 
counter.write('INCREMENT')
// 1
counter.write('INCREMENT')
// 2
counter.write('DECREMENT')
// 1

install

npm install reduxer

api

redux([options,] fn)

Create a Redux instance.

redux.obj([options,] fn)

Create a Redux instance with { objectMode: true }.

redux.ctor([options,] fn)

Create a Redux class.

options

  • all through2 options and an optional initial state object

attribution

Thanks to brycebaril. Borrowed from through2-reduce.

Package Sidebar

Install

npm i reduxer

Weekly Downloads

0

Version

0.4.1

License

MIT

Last publish

Collaborators

  • lukeburns