universalify
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -23,4 +23,8 @@ 'use strict' | ||
if (typeof cb !== 'function') return fn.apply(this, arguments) | ||
else fn.apply(this, arguments).then(r => cb(null, r), cb) | ||
else { | ||
delete arguments[arguments.length - 1] | ||
arguments.length-- | ||
fn.apply(this, arguments).then(r => cb(null, r), cb) | ||
} | ||
}, 'name', { value: fn.name }) | ||
} |
{ | ||
"name": "universalify", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Make a callback- or promise-based function support both promises and callbacks.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -24,3 +24,3 @@ # universalify | ||
Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with more than three arguments, and does not ensure that the callback is only called once. | ||
Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once. | ||
@@ -27,0 +27,0 @@ ```js |
4787
27