Skip to content

Commit

Permalink
feat: expose rules and blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkaron committed Sep 12, 2016
1 parent fb57ace commit a2c7ace
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
return function() {
var rules = slice.call(arguments);

return function() {
function compose() {
var config = this === root ? {} : this;
var result = slice.call(arguments);
var blueprints;

// Flatten & Clean
result = concat.apply(array, result).filter(clean, config);
// Transform
result = result.map(config.transform || transform, config);
// Flatten & Clean
result = concat.apply(array, result).filter(clean, config);
result = blueprints = concat.apply(array, result).filter(clean, config);
// Process
result = result.reduce(process.apply(config, rules), function Composition() {
var self = this;
Expand All @@ -53,8 +54,15 @@
return r;
}, arguments);
});
// Store blueprints
result.blueprints = blueprints;

return result;
}

// Store rules
compose.rules = rules;

return compose;
}
});

0 comments on commit a2c7ace

Please sign in to comment.