async-if-else
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -29,3 +29,3 @@ | ||
else | ||
elseStatement.apply(null, applyArguments); | ||
elseStatement.apply(null, applyArguments); | ||
} | ||
@@ -45,3 +45,5 @@ } | ||
var callback = args.pop(); | ||
callback.apply(null, args); | ||
callback.apply(null, [null].concat(args)); | ||
} | ||
{ | ||
"name": "async-if-else", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "'conditional if to async control flow'", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,19 @@ # async-if-else | ||
what about if without else ? | ||
```javascript | ||
var async = require('async'); | ||
var require('async-if-else').extend(async); | ||
async.waterfall([ | ||
async.constant({email: 'thiago@email.com', dogs: 2, money: 0, fun: 100 }), | ||
async.if(emailExists, auditLogging), | ||
publishToQueue | ||
], handler); | ||
``` | ||
#### Hey, if you found a BUG ! | ||
@@ -21,0 +37,0 @@ Amazing ! PR are always welcome |
14
test.js
@@ -176,2 +176,16 @@ var test = require('tape'); | ||
test('invalid predicate and sync statement', function(t) { | ||
async.waterfall([ | ||
async.constant({name: 'thiago'}), | ||
async.if(falsyValidation, createAccount), | ||
], verify); | ||
function verify(err, result) { | ||
t.notOk(err, 'there is no error'); | ||
t.equal(result.name, 'thiago', 'payload name is the same as initial'); | ||
t.notOk(result.id); | ||
t.end(); | ||
} | ||
}); | ||
test('must pass the result to next in chain after else statement', function(t){ | ||
@@ -178,0 +192,0 @@ async.waterfall([ |
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
11126
264
45