# Code coverage report for lib/route.js

## Statements: 100% (13 / 13) Branches: 66.67% (8 / 12) Functions: 100% (6 / 6) Lines: 100% (13 / 13) Ignored: none

All files » lib/ » route.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    231
    1
    1
    1
    3
    4

    1
    1

    4
    6
    6
    6

    1

     (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);