putil-waterfall
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -35,3 +35,9 @@ /* putil-waterfall | ||
try { | ||
fn(...args, next); | ||
const o = fn(...args, next); | ||
if (o && (o instanceof Promise || | ||
(typeof o.then === 'function' && typeof o.catch === 'function'))) { | ||
o.catch(err => { | ||
callback(err); | ||
}); | ||
} | ||
} catch (e) { | ||
@@ -38,0 +44,0 @@ callback(e); |
{ | ||
"name": "putil-waterfall", | ||
"description": "Simple, fast async waterfall NodeJs module for ES6.", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -31,16 +31,16 @@ # putil-waterfall | ||
waterfall([ | ||
function(callback) { | ||
function(next) { | ||
console.log('started'); | ||
callback(null, 1, 2); | ||
next(null, 1, 2); | ||
}, | ||
function(arg1, arg2, callback) { | ||
function(arg1, arg2, next) { | ||
let sum = arg1 + arg2; | ||
console.log('Current sum: ', sum); | ||
callback(null, sum, 3, 4); | ||
next(null, sum, 3, 4); | ||
}, | ||
function(arg1, arg2, arg3, callback) { | ||
function(arg1, arg2, arg3, next) { | ||
let sum = arg1 + arg2 + arg3; | ||
console.log('Current sum: ', sum); | ||
// arg1 now equals 'three' | ||
callback(null, sum + 10); | ||
next(null, sum + 10); | ||
} | ||
@@ -47,0 +47,0 @@ ], function(err, result) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6485
43