Helpers to work with arguments
Common assertions
Additional functions that adds to the original jam function.
Simple function that passes the values it receives to the next function.
Useful if you need a process.nextTick inserted in-between your call chain.
This function can also be passed to jam verbatim.
Alias for .identity. Use when you need a process.nextTick inserted in-between
your call chain.
Returns a set of values to the next function in the chain. Useful when you want to
pass in the next function verbatim without wrapping it in a function() { } just
to pass values into it.
Convenience for calling functions that accepts arguments in standard node.js
convention. Since jam insert next as first argument, most functions cannot be
passed directly into the jam chain, thus this helper function.
If no args is given, this function passes arguments given to next() call from
previous function directly to the function (with proper callback) placement).
Use this in combination with jam.return if you want to control the arguments that
are passed to the function.
Execute the given iterator for each element given in the array. The iterator is
given a next function and the element to act on.
You can also pass arguments and "strings" as an array.
Under the hood, a JAM step is added for each element. So the iterator will be called serially, one after another finish. A parallel version maybe added in the future.
Builds another JAM chain internally.
TODO: noError() ? or absorbError()
Exported function starts the asynchronous call chain.
The resolver will execute all functions passed to the chain as soon as nextTick.
Thus jam will not works across async context where the chain is not built all at
once in a single event loop, which is not really a problem from my personal
experience.
Any errors passed to next() are (fast-)forwarded to the last function in the chain skipping any functions that's left to be executed.
Any parameters given to next() are passed as arguments to the next function in the chain (except for errors, of course.)
Subsequent invocation of the function returned from the jam function simply adds
the given function to the chain.
lib/jam.js - Main JAM entrypoint