nodoc
Version:
A simple and 'low-level' source code comments parser and gitHub flavored markdown API documentation generator.
23 lines (22 loc) • 550 B
JavaScript
var Promise,
slice = [].slice;
Promise = require('yaku');
module.exports = function(fn, self) {
return function() {
var args;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
if (typeof args[args.length - 1] === 'function') {
return fn.apply(self, args);
}
return new Promise(function(resolve, reject) {
args.push(function(err, rs) {
if (err) {
return reject(err);
} else {
return resolve(rs);
}
});
return fn.apply(self, args);
});
};
};