Code coverage report for Livewire/lib/error.js

Statements: 60.87% (14 / 23)      Branches: 53.33% (8 / 15)      Functions: 44.44% (4 / 9)      Lines: 60.87% (14 / 23)      Ignored: none     

All files » Livewire/lib/ » error.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 37 381 1 1 1 1     1         1                     1 1   2 1 1 1         1      
(function(){
  var Result, ref$, Left, Right, handleError, devResult, handleException, out$ = typeof exports != 'undefined' && exports || this;
  Result = require('./result');
  ref$ = require('fantasy-eithers'), Left = ref$.Left, Right = ref$.Right;
  out$.handleError = handleError = curry$(function(f, g, e){
    return e.fold(f, g);
  });
  out$.devResult = devResult = handleError(function(err){
    return Result.error(e.stack).extract();
  }, function(res){
    return Result.ok(res).extract();
  });
  out$.handleException = handleException = function(f){
    return function(){
      var e;
      try {
        return Right(f.apply(this, arguments));
      } catch (e$) {
        e = e$;
        return Left(e);
      }
    };
  };
  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);