@f/to-middleware

1.0.1 • Public • Published

to-middleware

Build status Git tag NPM version Code style

Convert a function redux style middleware.

Installation

$ npm install @f/to-middleware

Usage

var toMiddleware = require('@f/to-middleware')
var bind = require('@f/bind-middleware')

var addOne = bind([toMiddleware(add)])

addOne(1) // => 2

function add (v) {
  return v + 1
}

API

toMiddleware(fn, type)

  • fn - unary function to use in middleware
  • type - type to match on - if matched payload is passed to fn - if not present action is passed to fn

Returns:

License

MIT

/@f/to-middleware/

    Package Sidebar

    Install

    npm i @f/to-middleware

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • f