iferr (0.1.5)
Published 2026-02-24 13:58:03 +00:00 by atheaadmin
Installation
registry=npm install iferr@0.1.5"iferr": "0.1.5"About this package
iferr
Higher-order functions for easier error handling.
if (err) return cb(err); be gone!
Install
npm install iferr
Use
JavaScript example
var iferr = require('iferr');
function get_friends_count(id, cb) {
User.load_user(id, iferr(cb, function(user) {
user.load_friends(iferr(cb, function(friends) {
cb(null, friends.length);
}));
}));
}
CoffeeScript example
iferr = require 'iferr'
get_friends_count = (id, cb) ->
User.load_user id, iferr cb, (user) ->
user.load_friends iferr cb, (friends) ->
cb null, friends.length
(TODO: document tiferr, throwerr and printerr)
License
MIT
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| coffee-script | ^1.7.1 |
| mocha | ^1.18.2 |
Keywords
error
errors