diff --git a/.eslintignore b/.eslintignore index f9eebe2..932192a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ !.eslintrc.js !jest.config.js +node_modules/ dist/ __tests__/coverage/ diff --git a/.eslintrc.js b/.eslintrc.js index f3c8379..509320c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,6 @@ /** * @file Manages the root configuration settings for project wide eslint. - * @module eslint/root/configuration - * @see {@link https://eslint.org} for further information. + * @see {@link https://eslint.org} For further information. */ module.exports = { diff --git a/.prettierignore b/.prettierignore index 298f3ef..932192a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ +!.eslintrc.js +!jest.config.js node_modules/ dist/ __tests__/coverage/ diff --git a/.travis.yml b/.travis.yml index afae7cb..5430535 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,9 @@ branches: notifications: email: false node_js: - - "10" - - "9" - - "8" + - '10' + - '9' + - '8' script: - npm run test:ci matrix: diff --git a/dist/attempt-x.esm.js b/dist/attempt-x.esm.js index 87a179e..c0dc901 100644 --- a/dist/attempt-x.esm.js +++ b/dist/attempt-x.esm.js @@ -26,6 +26,5 @@ export default function attempt(fn) { }; } } -; //# sourceMappingURL=attempt-x.esm.js.map \ No newline at end of file diff --git a/dist/attempt-x.esm.js.map b/dist/attempt-x.esm.js.map index 4dc8878..ebe0164 100644 --- a/dist/attempt-x.esm.js.map +++ b/dist/attempt-x.esm.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/attempt-x.js"],"names":[],"mappings":"AAAA;;;;;;;;;AASA,eAAe,SAAS,OAAT,CAAiB,EAAjB,EAA8B;AAC3C,MAAI;AAAA,sCADiC,IACjC;AADiC,MAAA,IACjC;AAAA;;AACF,WAAO;AACL,MAAA,KAAK,EAAE,KADF;;AAEL;AACA,MAAA,KAAK,EAAE,EAAE,CAAC,KAAH,CAAS,IAAT,EAAe,IAAf;AAHF,KAAP;AAKD,GAND,CAME,OAAO,CAAP,EAAU;AACV,WAAO;AACL,MAAA,KAAK,EAAE,IADF;AAEL,MAAA,KAAK,EAAE;AAFF,KAAP;AAID;AACF;AAAA","file":"attempt-x.esm.js","sourcesContent":["/**\n * This method attempts to invoke the function, returning either the result or\n * the caught error object. Any additional arguments are provided to the\n * function when it's invoked.\n *\n * @param {Function} [fn] - The function to attempt.\n * @param {...*} [args] - The arguments to invoke the function with.\n * @returns {object} Returns an object of the result.\n */\nexport default function attempt(fn, ...args) {\n try {\n return {\n threw: false,\n /* eslint-disable-next-line babel/no-invalid-this */\n value: fn.apply(this, args),\n };\n } catch (e) {\n return {\n threw: true,\n value: e,\n };\n }\n};\n"]} \ No newline at end of file +{"version":3,"sources":["../src/attempt-x.js"],"names":[],"mappings":"AAAA;;;;;;;;;AASA,eAAe,SAAS,OAAT,CAAiB,EAAjB,EAA8B;AAC3C,MAAI;AAAA,sCADiC,IACjC;AADiC,MAAA,IACjC;AAAA;;AACF,WAAO;AACL,MAAA,KAAK,EAAE,KADF;;AAEL;AACA,MAAA,KAAK,EAAE,EAAE,CAAC,KAAH,CAAS,IAAT,EAAe,IAAf;AAHF,KAAP;AAKD,GAND,CAME,OAAO,CAAP,EAAU;AACV,WAAO;AACL,MAAA,KAAK,EAAE,IADF;AAEL,MAAA,KAAK,EAAE;AAFF,KAAP;AAID;AACF","file":"attempt-x.esm.js","sourcesContent":["/**\n * This method attempts to invoke the function, returning either the result or\n * the caught error object. Any additional arguments are provided to the\n * function when it's invoked.\n *\n * @param {Function} [fn] - The function to attempt.\n * @param {...*} [args] - The arguments to invoke the function with.\n * @returns {object} Returns an object of the result.\n */\nexport default function attempt(fn, ...args) {\n try {\n return {\n threw: false,\n /* eslint-disable-next-line babel/no-invalid-this */\n value: fn.apply(this, args),\n };\n } catch (e) {\n return {\n threw: true,\n value: e,\n };\n }\n}\n"]} \ No newline at end of file diff --git a/dist/attempt-x.js b/dist/attempt-x.js index ee5ef35..0fff4bd 100644 --- a/dist/attempt-x.js +++ b/dist/attempt-x.js @@ -2,13 +2,13 @@ { "author": "Graham Fairweather", "copywrite": "Copyright (c) 2017-present", - "date": "2019-07-13T02:00:15.472Z", + "date": "2019-07-14T21:33:26.506Z", "describe": "", "description": "Invokes function, returning an object of the results.", "file": "attempt-x.js", - "hash": "9bf220810a54a74e07b4", + "hash": "65dd4ffec2ee60d824d1", "license": "MIT", - "version": "2.0.2" + "version": "2.0.3" } */ (function webpackUniversalModuleDefinition(root, factory) { @@ -158,7 +158,6 @@ function attempt(fn) { }; } } -; diff --git a/dist/attempt-x.js.map b/dist/attempt-x.js.map index ddcbda5..8ed6d5f 100644 --- a/dist/attempt-x.js.map +++ b/dist/attempt-x.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://attemptX/webpack/universalModuleDefinition","webpack://attemptX/webpack/bootstrap","webpack://attemptX/../src/attempt-x.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;AACD,O;AC1BA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;AClFA;AAAA;AAAA;;;;;;;;;AASe,SAAS,OAAT,CAAiB,EAAjB,EAA8B;AAC3C,MAAI;AAAA,sCADiC,IACjC;AADiC,UACjC;AAAA;;AACF,WAAO;AACL,WAAK,EAAE,KADF;;AAEL;AACA,WAAK,EAAE,EAAE,CAAC,KAAH,CAAS,IAAT,EAAe,IAAf;AAHF,KAAP;AAKD,GAND,CAME,OAAO,CAAP,EAAU;AACV,WAAO;AACL,WAAK,EAAE,IADF;AAEL,WAAK,EAAE;AAFF,KAAP;AAID;AACF;AAAA","file":"attempt-x.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"attemptX\"] = factory();\n\telse\n\t\troot[\"attemptX\"] = factory();\n})((function () {\n 'use strict';\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n return Function('return this')();\n}()), function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * This method attempts to invoke the function, returning either the result or\n * the caught error object. Any additional arguments are provided to the\n * function when it's invoked.\n *\n * @param {Function} [fn] - The function to attempt.\n * @param {...*} [args] - The arguments to invoke the function with.\n * @returns {object} Returns an object of the result.\n */\nexport default function attempt(fn, ...args) {\n try {\n return {\n threw: false,\n /* eslint-disable-next-line babel/no-invalid-this */\n value: fn.apply(this, args),\n };\n } catch (e) {\n return {\n threw: true,\n value: e,\n };\n }\n};\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://attemptX/webpack/universalModuleDefinition","webpack://attemptX/webpack/bootstrap","webpack://attemptX/../src/attempt-x.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;AACD,O;AC1BA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;AClFA;AAAA;AAAA;;;;;;;;;AASe,SAAS,OAAT,CAAiB,EAAjB,EAA8B;AAC3C,MAAI;AAAA,sCADiC,IACjC;AADiC,UACjC;AAAA;;AACF,WAAO;AACL,WAAK,EAAE,KADF;;AAEL;AACA,WAAK,EAAE,EAAE,CAAC,KAAH,CAAS,IAAT,EAAe,IAAf;AAHF,KAAP;AAKD,GAND,CAME,OAAO,CAAP,EAAU;AACV,WAAO;AACL,WAAK,EAAE,IADF;AAEL,WAAK,EAAE;AAFF,KAAP;AAID;AACF","file":"attempt-x.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"attemptX\"] = factory();\n\telse\n\t\troot[\"attemptX\"] = factory();\n})((function () {\n 'use strict';\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n }\n\n return Function('return this')();\n}()), function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/**\n * This method attempts to invoke the function, returning either the result or\n * the caught error object. Any additional arguments are provided to the\n * function when it's invoked.\n *\n * @param {Function} [fn] - The function to attempt.\n * @param {...*} [args] - The arguments to invoke the function with.\n * @returns {object} Returns an object of the result.\n */\nexport default function attempt(fn, ...args) {\n try {\n return {\n threw: false,\n /* eslint-disable-next-line babel/no-invalid-this */\n value: fn.apply(this, args),\n };\n } catch (e) {\n return {\n threw: true,\n value: e,\n };\n }\n}\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/attempt-x.min.js b/dist/attempt-x.min.js index b74dfcf..0fcc9d0 100644 --- a/dist/attempt-x.min.js +++ b/dist/attempt-x.min.js @@ -2,13 +2,13 @@ { "author": "Graham Fairweather", "copywrite": "Copyright (c) 2017-present", - "date": "2019-07-13T02:00:15.472Z", + "date": "2019-07-14T21:33:26.506Z", "describe": "", "description": "Invokes function, returning an object of the results.", "file": "attempt-x.min.js", - "hash": "8b9167a04b0ab10b5d6c", + "hash": "84a9518beb70e1de9d34", "license": "MIT", - "version": "2.0.2" + "version": "2.0.3" } */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.attemptX=t():e.attemptX=t()}(function(){"use strict";return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()}(),function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r