{"_id":"error-first-handler","_rev":"174977","name":"error-first-handler","description":"handles error first callbacks","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"boennemann","email":"stephan@boennemann.me"}],"time":{"modified":"2021-06-03T11:56:41.000Z","created":"2015-02-02T19:51:53.954Z","1.0.1":"2015-02-02T20:07:37.978Z","1.0.0":"2015-02-02T19:51:53.954Z"},"users":{},"author":{"name":"Stephan Bönnemann","email":"stephan@boennemann.me"},"repository":{"type":"git","url":"https://github.com/boennemann/error-first-handler.git"},"versions":{"1.0.1":{"name":"error-first-handler","description":"handles error first callbacks","version":"1.0.1","author":{"name":"Stephan Bönnemann","email":"stephan@boennemann.me"},"bugs":{"url":"https://github.com/boennemann/error-first-handler/issues"},"devDependencies":{"semantic-release":"^1.1.1","standard":"^2.3.1","tap-spec":"^2.2.0","tape":"^3.5.0"},"homepage":"https://github.com/boennemann/error-first-handler","keywords":["error","handling","callbacks","error-first"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/boennemann/error-first-handler.git"},"scripts":{"test":"standard && node tests | tap-spec","prepublish":"semantic-release pre","postpublish":"semantic-release post"},"gitHead":"665c2f1900f48dba7f2d7d89b2ba84764946cb32","_id":"error-first-handler@1.0.1","_shasum":"22c7a6135255a88fd9bdb491339aa5c16eded564","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"boennemann","email":"stephan@boennemann.me"},"maintainers":[{"name":"boennemann","email":"stephan@boennemann.me"}],"dist":{"shasum":"22c7a6135255a88fd9bdb491339aa5c16eded564","size":1861,"noattachment":false,"key":"/error-first-handler/-/error-first-handler-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/error-first-handler/download/error-first-handler-1.0.1.tgz"},"directories":{},"publish_time":1422907657978,"_cnpm_publish_time":1422907657978,"_hasShrinkwrap":false},"1.0.0":{"name":"error-first-handler","description":"handles error first callbacks","version":"1.0.0","author":{"name":"Stephan Bönnemann","email":"stephan@boennemann.me"},"bugs":{"url":"https://github.com/boennemann/error-first-handler/issues"},"devDependencies":{"semantic-release":"^1.1.1","standard":"^2.3.1","tap-spec":"^2.2.0","tape":"^3.5.0"},"homepage":"https://github.com/boennemann/error-first-handler","keywords":["error","handling","callbacks","error-first"],"license":"MIT","main":"index.js","repository":{"type":"git","url":"https://github.com/boennemann/error-first-handler.git"},"scripts":{"test":"standard && node tests | tap-spec","prepublish":"semantic-release pre","postpublish":"semantic-release post"},"gitHead":"77d83b5cc096bc991d52b1f4b31d5a1f39b03380","_id":"error-first-handler@1.0.0","_shasum":"7ff536b8815bee4993fe7ce141bb88fff21f0e4f","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"boennemann","email":"stephan@boennemann.me"},"maintainers":[{"name":"boennemann","email":"stephan@boennemann.me"}],"dist":{"shasum":"7ff536b8815bee4993fe7ce141bb88fff21f0e4f","size":1853,"noattachment":false,"key":"/error-first-handler/-/error-first-handler-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/error-first-handler/download/error-first-handler-1.0.0.tgz"},"directories":{},"publish_time":1422906713954,"_cnpm_publish_time":1422906713954,"_hasShrinkwrap":false}},"readme":"# error-first-handler\n[![Build Status](https://travis-ci.org/boennemann/error-first-handler.svg)](https://travis-ci.org/boennemann/error-first-handler)\n[![Dependency Status](https://david-dm.org/boennemann/error-first-handler.svg)](https://david-dm.org/boennemann/error-first-handler)\n[![devDependency Status](https://david-dm.org/boennemann/error-first-handler/dev-status.svg)](https://david-dm.org/boennemann/error-first-handler#info=devDependencies)\n\n[![NPM](https://nodei.co/npm/error-first-handler.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/error-first-handler/)\n\n> handles error first callbacks\n\n```bash\nnpm i -S error-first-handler\n```\n```js\nvar fs = require('fs')\nvar efh = require('error-first-handler')\n\nvar default = efh()\nfs.readFile('./package.json', default(function (data) {\n  // If an error occured it is thrown\n  // Otherwhise the error is shaved off the arguments array\n}))\n\nvar custom = efh(function (err) {\n  console.log(err)\n})\nfs.readFile('./package.json', custom(function (data) {\n  // If an error occured it is logged\n  // Otherwhise the error is shaved off the arguments array\n}))\n\nvar custom2 = efh(function (err) {\n  console.log(err)\n  return true\n})\nfs.readFile('./package.json', custom2(function (data) {\n  // If an error occured it is logged\n  // As the handler returns a truthy value the callback is executed\n}))\n\n// Passing errors to a parent callback is easy\nfunction readFile(cb) {\n  fs.readFile('./package.json', efh(cb)(function {\n    // If an error occured it is handled by the parent callback\n    // Otherwhise the error is shaved off the arguments array\n  }))  \n}\n```\n\nMIT License\n2015 Stephan Bönnemann\n","_attachments":{},"homepage":"https://github.com/boennemann/error-first-handler","bugs":{"url":"https://github.com/boennemann/error-first-handler/issues"},"license":"MIT"}