A function that pipes the results of one function to the next
- Require the Papoose module
- Set up the functions that you wish to use (example)
- Invoke pipe by passing in all your functions as arguments. Note: These functions execute in the order you pass them
- Invoke the function returned from the step above by passing in the arguments you'd want to start off the pipe process with. Note: These arguments are used by the first function in the step above, and the result is piped to the subsequent function.
pipeFn(1,2,3);
var papoose = require('papoose');
function foo(a, b, c) {
return a + b + c;
}
function bar(a) {
return a * a;
}
function baz(a) {
return a - 1;
}
var pipeFn = papoose.pipe(foo, bar, baz);
- Instantiate a Papoose object
- Set up the functions that you wish to use (example)
- Invoke pipe by passing in all your functions as arguments. Note: These functions execute in the order you pass them
- Invoke the function returned from the step above by passing in the arguments you'd want to start off the pipe process with. Note: These arguments are used by the first function in the step above, and the result is piped to the subsequent function.
pipeFn(1,2,3);
var papoose = new Papoose();
function foo(a, b, c) {
return a + b + c;
}
function bar(a) {
return a * a;
}
function baz(a) {
return a - 1;
}
var pipeFn = papoose.pipe(foo, bar, baz);