1.0.1 • Published 10 years ago

callback-or-emit-error v1.0.1

Weekly downloads
6
License
MIT
Repository
-
Last release
10 years ago

callback-or-emit-error

Callback or emit an error when something is bad.

When you want to support both events and callbacks

If you also keep writing code like this:

  if (typeof callback === 'function') {
    return callback(err);
  } else {
    return this.emit('error', err);
  }

Then this module is for you!

Now just:

  return callbackOrEmitError(this, callback, err);

Installation

npm install callback-or-emit-error

Tests

npm test

MIT Licensed

1.0.1

10 years ago

1.0.0-doc

10 years ago

1.0.0

10 years ago