first commit
This commit is contained in:
87
build/node_modules/attempt-x/lib/attempt-x.js
generated
vendored
Normal file
87
build/node_modules/attempt-x/lib/attempt-x.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
||||
/**
|
||||
* @file Invokes function, returning an object of the results.
|
||||
* @version 1.1.1
|
||||
* @author Xotic750 <Xotic750@gmail.com>
|
||||
* @copyright Xotic750
|
||||
* @license {@link <https://opensource.org/licenses/MIT> MIT}
|
||||
* @module attempt-x
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var getArgs = function _getArgs(args) {
|
||||
var length = args.length >>> 0;
|
||||
var array = [];
|
||||
var argLength = length - 1;
|
||||
if (argLength < 1) {
|
||||
return array;
|
||||
}
|
||||
|
||||
array.length = argLength;
|
||||
for (var index = 1; index < length; index += 1) {
|
||||
array[index - 1] = args[index];
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method attempts to invoke the function, returning either the result or
|
||||
* the caught error object. Any additional arguments are provided to the
|
||||
* function when it's invoked.
|
||||
*
|
||||
* @param {Function} fn - The function to attempt.
|
||||
* @param {...*} [args] - The arguments to invoke the function with.
|
||||
* @returns {Object} Returns an object of the result.
|
||||
* @example
|
||||
* var attempt = require('attempt-x');
|
||||
*
|
||||
* function thrower() {
|
||||
* throw new Error('Threw');
|
||||
* }
|
||||
*
|
||||
* attempt(thrower, 1, 2);
|
||||
* // {
|
||||
* // threw: true,
|
||||
* // value: // Error('Threw') object
|
||||
* // }
|
||||
*
|
||||
* function sumArgs(a, b) {
|
||||
* return a + b;
|
||||
* }
|
||||
*
|
||||
* attempt(sumArgs, 1, 2);
|
||||
* // {
|
||||
* // threw: false,
|
||||
* // value: 3
|
||||
* // }
|
||||
*
|
||||
* var thisArg = [];
|
||||
* function pusher(a, b) {
|
||||
* return this.push(a, b);
|
||||
* }
|
||||
*
|
||||
* attempt.call(thisArg, pusher, 1, 2);
|
||||
* // {
|
||||
* // threw: false,
|
||||
* // value: 2
|
||||
* // }
|
||||
* // thisArg => [1, 2];
|
||||
*/
|
||||
module.exports = function attempt(fn) {
|
||||
try {
|
||||
return {
|
||||
threw: false,
|
||||
value: fn.apply(this, getArgs(arguments))
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
threw: true,
|
||||
value: e
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
},{}]},{},[1])(1)
|
||||
});
|
||||
9
build/node_modules/attempt-x/lib/attempt-x.min.js
generated
vendored
Normal file
9
build/node_modules/attempt-x/lib/attempt-x.min.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).returnExports=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){/**
|
||||
* @file Invokes function, returning an object of the results.
|
||||
* @version 1.1.1
|
||||
* @author Xotic750 <Xotic750@gmail.com>
|
||||
* @copyright Xotic750
|
||||
* @license {@link <https://opensource.org/licenses/MIT> MIT}
|
||||
* @module attempt-x
|
||||
*/
|
||||
"use strict";var getArgs=function _getArgs(args){var length=args.length>>>0,array=[],argLength=length-1;if(argLength<1)return array;array.length=argLength;for(var index=1;index<length;index+=1)array[index-1]=args[index];return array};module.exports=function attempt(fn){try{return{threw:!1,value:fn.apply(this,getArgs(arguments))}}catch(e){return{threw:!0,value:e}}}},{}]},{},[1])(1)});
|
||||
1
build/node_modules/attempt-x/lib/attempt-x.min.js.map
generated
vendored
Normal file
1
build/node_modules/attempt-x/lib/attempt-x.min.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["lib/attempt-x.js"],"names":["f","exports","module","define","amd","window","global","self","this","returnExports","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","_dereq_","getArgs","_getArgs","args","array","argLength","index","attempt","fn","threw","value","apply","arguments"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,UAAUH,OAAO,EAA0B,oBAATK,OAAwBA,OAA+B,oBAATC,OAAwBA,OAA6B,oBAAPC,KAAsBA,KAAYC,MAAOC,cAAgBT,KAAlU,CAAyU,WAAqC,OAAO,SAAUU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATC,SAAqBA,QAAQ,IAAIF,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGI,EAAE,OAAOA,EAAEJ,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