(function(){
var σ;
σ = require('highland');
exports.route = curry$(function(fns, req){
return fns.reduce(function(acc, fn){
return acc.otherwise(fn(req));
}, σ([]));
});
function curry$(f, bound){
var context,
_curry = function(args) {
return f.length > 1 ? function(){
var params = args ? args.concat() : [];
context = bound ? context || this : this;
return params.push.apply(params, arguments) <
f.length && arguments.length ?
_curry.call(context, params) : f.apply(context, params);
} : f;
};
return _curry();
}
}).call(this);
|