maybe-callback

2.1.0 • Public • Published

maybe-callback NPM Version Build Status

Maybe call a callback if it really is who it says it is.

Installation

Node.js is required. To install, type this at the command line:

npm install maybe-callback

Usage

var maybeCallback = require('maybe-callback');
 
function callback(arg) {
    return arg + 1;
}
 
maybeCallback(callback)(1);  //=> 2
maybeCallback(null)(1);  //=> undefined
 
var once = maybeCallback.once(callback);
once(1); //=> 2
once(1); //=> undefined

Package Sidebar

Install

npm i maybe-callback

Weekly Downloads

6,546

Version

2.1.0

License

MIT

Last publish

Collaborators

  • robskillington