maybe-callback
v2.1.0
Published
Maybe call a callback if it's a function
Downloads
41,005
Maintainers
Readme
maybe-callback
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