denodeify
Advanced tools
Comparing version 1.0.0 to 1.1.0
14
index.js
@@ -1,10 +0,14 @@ | ||
module.exports = function(fun) { | ||
module.exports = function(fun, filter) { | ||
return function() { | ||
var args = Array.prototype.slice.call(arguments, 0); | ||
return new Promise(function(resolve, reject) { | ||
args.push(function(err, data) { | ||
if (err) { | ||
reject(err); | ||
args.push(function(err) { | ||
var args = Array.prototype.slice.call(arguments, 0); | ||
if (filter) { | ||
args = filter.apply(this, args); | ||
} | ||
if (args[0]) { | ||
reject(args[0]); | ||
} else { | ||
resolve(data); | ||
resolve(args[1]); | ||
} | ||
@@ -11,0 +15,0 @@ }); |
{ | ||
"name": "denodeify", | ||
"version": "1.0.0", | ||
"description": "", | ||
"version": "1.1.0", | ||
"description": "Tool to wrap functions with Node style APIs", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "directories": { |
3246
6
73