Code coverage report for Livewire/lib/body.js

Statements: 85.71% (18 / 21)      Branches: 46.67% (7 / 15)      Functions: 83.33% (5 / 6)      Lines: 85.71% (18 / 21)      Ignored: none     

All files » Livewire/lib/ » body.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 371 1 1 1 1 1 1 1 1 1 1                       1 1   1 1 1 1         1      
(function(){
  var async, getBody, ref$, EitherT, Left, Promise, EitherPromise, bodyParams, out$ = typeof exports != 'undefined' && exports || this;
  async = require('fantasy-async');
  getBody = async(require('raw-body'));
  ref$ = require('fantasy-eithers'), EitherT = ref$.EitherT, Left = ref$.Left;
  Promise = require('fantasy-promises');
  EitherPromise = EitherT(Promise);
  out$.bodyParams = bodyParams = curry$(function(parser, req){
    var err;
    try {
      return getBody(req, {
        length: req.headers['content-length'],
        encoding: 'utf8',
        limit: '1mb'
      }).map(parser);
    } catch (e$) {
      err = e$;
      return EitherPromise(new Promise((function(it){
        return it(Left(err));
      })));
    }
  });
  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);