arch-orchestrator
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -52,3 +52,7 @@ 'use strict'; | ||
metadata.argsTo.forEach(function (fn) { | ||
fn.meta.args = args.slice(); | ||
if (!fn.meta.args) { | ||
fn.meta.args = args.slice(); | ||
} else { | ||
fn.meta.args = fn.meta.args.concat(args.slice()); | ||
} | ||
}); | ||
@@ -65,3 +69,7 @@ } | ||
metadata.resultTo.forEach(function (fn) { | ||
fn.meta.args = result; | ||
if (!fn.meta.args) { | ||
fn.meta.args = result; | ||
} else { | ||
fn.meta.args = fn.meta.args.concat(result); | ||
} | ||
}); | ||
@@ -68,0 +76,0 @@ } |
{ | ||
"name": "arch-orchestrator", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Orchestrator for large node.js applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -204,3 +204,24 @@ arch-orchestrator | ||
You can call ``resultTo`` and ``argsTo`` multiple times, or even combine them. | ||
##### Example: | ||
```Javascript | ||
var fn = orchestrator() | ||
.setNext(fn1).argsTo(fn4) | ||
.setNext(fn2).resultTo(fn4) | ||
.setNext(fn3) | ||
.setNext(fn4) | ||
.end(); | ||
``` | ||
In this case arguments on ``fn4`` will be available in order as functions ``argsTo`` and ``resultTo`` are called, | ||
so ``fn4`` can look like: | ||
```Javascript | ||
function fn4(next, argFromArgsTo, argFromResultTo) { | ||
// do something awesome | ||
} | ||
``` | ||
# License | ||
**MIT** |
@@ -24,2 +24,6 @@ 'use strict'; | ||
function fn4(next, arg1, arg2) { | ||
return next(arg1 + arg2 + 10); | ||
} | ||
function first(next) { | ||
@@ -217,2 +221,14 @@ return next('first'); | ||
it('should be able to prepend arguments which are arguments of some other generator chain function calling argsTo multiple times', function () { | ||
fn = orchestrator() | ||
.setNext(fn1).argsTo(fn4) | ||
.setNext(fn2).argsTo(fn4) | ||
.setNext(fn3) | ||
.setNext(fn4) | ||
.end(); | ||
var res = fn(5); | ||
res.should.be.exactly(120); | ||
}); | ||
it('should be able to prepend arguments which are arguments of some other generator chain function', function * () { | ||
@@ -262,2 +278,14 @@ fn = orchestrator() | ||
it('should be able to prepend arguments which are result of some function multiple times', function () { | ||
fn = orchestrator() | ||
.setNext(fn1).resultTo(fn4) | ||
.setNext(fn2) | ||
.setNext(fn3).resultTo(fn4) | ||
.setNext(fn4) | ||
.end(); | ||
var res = fn(10); | ||
res.should.be.exactly(730); | ||
}); | ||
it('should be able to prepend arguments which are result of some generator function', function * () { | ||
@@ -278,2 +306,14 @@ fn = orchestrator() | ||
it('should be able to combine argsTo and resultTo calls', function () { | ||
fn = orchestrator() | ||
.setNext(fn1).argsTo(fn4) | ||
.setNext(fn2).resultTo(fn4) | ||
.setNext(fn3) | ||
.setNext(fn4) | ||
.end(); | ||
var res = fn(5); | ||
res.should.be.exactly(320); | ||
}); | ||
it('should be able to use current result as final for normal chain functions', function () { | ||
@@ -280,0 +320,0 @@ fn = orchestrator() |
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
25590
655
227