"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/iferr/index.js" (11 Apr 2017, 1069 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Generated by CoffeeScript 1.7.1
    2 (function() {
    3   var exports, iferr, printerr, throwerr, tiferr,
    4     __slice = [].slice;
    5 
    6   iferr = function(fail, succ) {
    7     return function() {
    8       var a, err;
    9       err = arguments[0], a = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
   10       if (err != null) {
   11         return fail(err);
   12       } else {
   13         return typeof succ === "function" ? succ.apply(null, a) : void 0;
   14       }
   15     };
   16   };
   17 
   18   tiferr = function(fail, succ) {
   19     return iferr(fail, function() {
   20       var a, err;
   21       a = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
   22       try {
   23         return succ.apply(null, a);
   24       } catch (_error) {
   25         err = _error;
   26         return fail(err);
   27       }
   28     });
   29   };
   30 
   31   throwerr = iferr.bind(null, function(err) {
   32     throw err;
   33   });
   34 
   35   printerr = iferr(function(err) {
   36     return console.error(err.stack || err);
   37   });
   38 
   39   module.exports = exports = iferr;
   40 
   41   exports.iferr = iferr;
   42 
   43   exports.tiferr = tiferr;
   44 
   45   exports.throwerr = throwerr;
   46 
   47   exports.printerr = printerr;
   48 
   49 }).call(this);