Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

iferr

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Issues
File Explorer

Advanced tools

iferr

Higher-order functions for easier error handling

    1.0.2latest

Version published
Maintainers
1
Weekly downloads
9,273,567
decreased by-10.76%

Weekly downloads

Readme

Source

iferr

Higher-order functions for easier error handling.

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

Install

npm install iferr

Use

JavaScript/ES6 example

var iferr = require('iferr'); function get_friends_count(id, cb) { User.load_user(id, iferr(cb, user => user.load_friends(iferr(cb, friends => cb(null, friends.length) )) )) }

JavaScript/ES5 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

Keywords

FAQs

What is iferr?

Higher-order functions for easier error handling

Is iferr popular?

The npm package iferr receives a total of 8,860,853 weekly downloads. As such, iferr popularity was classified as popular.

Is iferr well maintained?

We found that iferr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 18 Jun 2018

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc