glom
Tranformation chain utilizing an accumulating mixin (called a glom) input parameter.
Install
npm install glom
Example
If one was to describe the atomic actions required to create a new account using a chain of asynchronous functions, your Glom would look like this:
// A chain of business rules for account creation validateUserInput isEmailUnique createUser createDefaultPermissions deleteUser createError returnJson // Sidechain in case of failure notifyAdmin registerNewUserStats returnJson;
Additional Usage
var Glom = ; { ; } { thissnapshots; ;} { if value > 5 ; else ; } { console; ;} { ;} ;
Notice that each method in a Glom has its own parameters, allowing any simple, testable, and potentially isomorphic method to be used by Glom, provided the last two parameters are callbacks named next
and error
. Please see the tests for more use cases.