0.0.2 • Published 7 years ago

tpipe-redux v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

TPipe Express npm version license type npm downloads ECMAScript 6 & 5 js-standard-style

TPipe Express is a common redux tpipe mapping set. So you can easily pipe your redux handlers.

import { piper } from 'tpipe'
import reduxPipeSet, { mapActionToInput, createBodyDispatcher } from 'tpipe-redux'

 // piper returns an object with a pipe inside to be injected in redux
const saveThunk = piper(
  (input) => {
    validate(input.body) // a client side validation, for example
    // your stuff like an api call
    return {
      ...input
    }
  }
)
.input(mapActionToInput)
.input(createBodyDispatcher(saveRequest)) // action creator that receives a payload
.output(createBodyDispatcher(saved)) // another action creator
.error(createBodyDispatcher(saveError)) // another action creator
// .finally() // you can also use a finally
.pipe
.getThunk() // this a regular thunk to be executed using the redux-thunk middleware

Or using the incorporate function from the piper

import { piper } from 'tpipe'
import reduxPipeSet, { mapActionToInput, createBodyDispatcher } from 'tpipe-redux'

 // piper returns an object with a pipe inside to be injected in redux
const saveThunk = piper(
  (input) => {
    validate(input.body) // a client side validation, for example
    // your stuff like an api call
    return {
      ...input
    }
  }
)
.incorporate(reduxPipeSet) // this is recommended
.input(createBodyDispatcher(saveRequest)) // action creator that receives a payload
.output(createBodyDispatcher(saved)) // another action creator
.error(createBodyDispatcher(saveError)) // another action creator
// .finally() // you can also use a finally
.pipe
.getThunk() // this a regular thunk to be executed using the redux-thunk middleware

Quality and Compatibility

Build Status Coverage Status bitHound Score Dependency Status Dev Dependency Status

Every build and release is automatically tested on the following platforms:

node 5.x node 6.x

Installation

Copy and paste the following command into your terminal to install TPipe Express:

npm install tpipe-redux --save

How to Contribute

You can submit your ideas through our issues system, or make the modifications yourself and submit them to us in the form of a GitHub pull request.

Running Tests

It's easy to run the test suite locally, and highly recommended if you're using tpipe-redux on a platform we aren't automatically testing for.

npm test