iferr

WebJar for iferr

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

iferr
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

iferr
WebJar for iferr
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/shesek/iferr

Download iferr

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/iferr/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>iferr</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/iferr/
implementation 'org.webjars.npm:iferr:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/iferr/
implementation ("org.webjars.npm:iferr:1.0.2")
'org.webjars.npm:iferr:jar:1.0.2'
<dependency org="org.webjars.npm" name="iferr" rev="1.0.2">
  <artifact name="iferr" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='iferr', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "iferr" % "1.0.2"
[org.webjars.npm/iferr "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.0.2
0.1.5