404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.218.137.145: ~ $
# iferr

Higher-order functions for easier error handling.

`if (err) return cb(err);` be gone!

## Install
```bash
npm install iferr
```

## Use

### JavaScript example
```js
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
```coffee
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

Filemanager

Name Type Size Permission Actions
.npmignore File 13 B 0644
LICENSE File 1.05 KB 0644
README.md File 675 B 0644
index.coffee File 803 B 0644
index.js File 1.04 KB 0644
package.json File 1.31 KB 0644