create-errback

1.0.0 • Public • Published

create-errback Build Status

Compose a Node errback using an error and success handler

Install

$ npm install --save create-errback

Usage

var createErrback = require('create-errback')

var errback = createErrback(onError, onSuccess)
//=> function

function onError (err) {
  // ...
}

function onSuccess (result) {
 // ...
}

API

createErrback(onError, onSuccess) -> function

onError

Required
Type: function

A function to be called when the returned function is called with an error.

onSuccess

Required
Type: function

A function to be called when the returned function does not receive an error. If the errback is called with multiple arguments, these will all be passed to onSuccess.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i create-errback

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker