0.3.4 • Published 10 years ago

@koax/bind v0.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 years ago

bind

Build status Git tag NPM version Code style

Exposes a curried api to create a middleware dispatcher with promise and thunk support.

Installation

$ npm install @koax/bind

Usage

import bind from '@koax/bind'

let dispatch = bind({fetched: 'google'})(
  function * (action, next, ctx) {
    if (action === 'foo') return Promise.resolve('bar')
    return next()
  }
])

dispatch('foo').then((res) => res) // => 'bar'
disaptch('qux').then((res) => res) // => 'qux'

API

bind (ctx) => (middleware)

  • ctx - the context to bind the middleware to
  • middleware - array of koax middleware

Returns: dispatch function for koax middleware stack

License

MIT

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago