diff options
Diffstat (limited to 'desktop/node_modules/es6-error')
-rw-r--r-- | desktop/node_modules/es6-error/CHANGELOG.md | 26 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/LICENSE.md | 21 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/README.md | 59 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/es6/index.js | 72 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/lib/index.js | 79 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/package.json | 48 | ||||
-rw-r--r-- | desktop/node_modules/es6-error/typings/index.d.ts | 1 |
7 files changed, 306 insertions, 0 deletions
diff --git a/desktop/node_modules/es6-error/CHANGELOG.md b/desktop/node_modules/es6-error/CHANGELOG.md new file mode 100644 index 0000000..9e82c81 --- /dev/null +++ b/desktop/node_modules/es6-error/CHANGELOG.md @@ -0,0 +1,26 @@ +# Change Log + +## [v4.0.1] - 2017-01-04 +### Fixed + - jsnext build uses `babel-plugin-transform-builtin-extend` (#27) + +## [v4.0.0] - 2016-10-03 +### Added + - jsnext build (#26) + +## [v3.2.0] - 2016-09-29 +### Added + - TypeScript definitions (#24) + +## [v3.1.0] - 2016-09-08 +### Changed + - Point jsnext build to transpiled code (#23) + +## [v3.0.1] - 2016-07-14 +### Changed + - Move Babel config to `.babelrc` (#20) + +## [v3.0.0] - 2016-05-18 +### Changed + - Upgrade to Babel 6 (#16) + - Make `message`, `name`, and `stack` properties configurable (to match built-in `Error`) (#17) diff --git a/desktop/node_modules/es6-error/LICENSE.md b/desktop/node_modules/es6-error/LICENSE.md new file mode 100644 index 0000000..4737fd1 --- /dev/null +++ b/desktop/node_modules/es6-error/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Ben Youngblood + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/desktop/node_modules/es6-error/README.md b/desktop/node_modules/es6-error/README.md new file mode 100644 index 0000000..8a8f130 --- /dev/null +++ b/desktop/node_modules/es6-error/README.md @@ -0,0 +1,59 @@ +# es6-error + +[![npm version](https://badge.fury.io/js/es6-error.svg)](https://www.npmjs.com/package/es6-error) +[![Build Status](https://travis-ci.org/bjyoungblood/es6-error.svg?branch=master)](https://travis-ci.org/bjyoungblood/es6-error) + +An easily-extendable error class for use with ES6 classes (or ES5, if you so +choose). + +Tested in Node 4.0, Chrome, and Firefox. + +## Why? + +I made this because I wanted to be able to extend Error for inheritance and type +checking, but can never remember to add +`Error.captureStackTrace(this, this.constructor.name)` to the constructor or how +to get the proper name to print from `console.log`. + +## ES6 Usage + +```javascript + +import ExtendableError from 'es6-error'; + +class MyError extends ExtendableError { + // constructor is optional; you should omit it if you just want a custom error + // type for inheritance and type checking + constructor(message = 'Default message') { + super(message); + } +} + +export default MyError; +``` + +## ES5 Usage + +```javascript + +var util = require('util'); +var ExtendableError = require('es6-error'); + +function MyError(message) { + message = message || 'Default message'; + ExtendableError.call(this, message); +} + +util.inherits(MyError, ExtendableError); + +module.exports = MyError; +``` + +### Known Issues + +- Uglification can obscure error class names ([#31](https://github.com/bjyoungblood/es6-error/issues/31#issuecomment-301128220)) + +#### Todo + +- Better browser compatibility +- Browser tests diff --git a/desktop/node_modules/es6-error/es6/index.js b/desktop/node_modules/es6-error/es6/index.js new file mode 100644 index 0000000..70fbfbc --- /dev/null +++ b/desktop/node_modules/es6-error/es6/index.js @@ -0,0 +1,72 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +export default ExtendableError; diff --git a/desktop/node_modules/es6-error/lib/index.js b/desktop/node_modules/es6-error/lib/index.js new file mode 100644 index 0000000..617bef7 --- /dev/null +++ b/desktop/node_modules/es6-error/lib/index.js @@ -0,0 +1,79 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +function _extendableBuiltin(cls) { + function ExtendableBuiltin() { + cls.apply(this, arguments); + } + + ExtendableBuiltin.prototype = Object.create(cls.prototype, { + constructor: { + value: cls, + enumerable: false, + writable: true, + configurable: true + } + }); + + if (Object.setPrototypeOf) { + Object.setPrototypeOf(ExtendableBuiltin, cls); + } else { + ExtendableBuiltin.__proto__ = cls; + } + + return ExtendableBuiltin; +} + +var ExtendableError = function (_extendableBuiltin2) { + _inherits(ExtendableError, _extendableBuiltin2); + + function ExtendableError() { + var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + _classCallCheck(this, ExtendableError); + + // extending Error is weird and does not propagate `message` + var _this = _possibleConstructorReturn(this, (ExtendableError.__proto__ || Object.getPrototypeOf(ExtendableError)).call(this, message)); + + Object.defineProperty(_this, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }); + + Object.defineProperty(_this, 'name', { + configurable: true, + enumerable: false, + value: _this.constructor.name, + writable: true + }); + + if (Error.hasOwnProperty('captureStackTrace')) { + Error.captureStackTrace(_this, _this.constructor); + return _possibleConstructorReturn(_this); + } + + Object.defineProperty(_this, 'stack', { + configurable: true, + enumerable: false, + value: new Error(message).stack, + writable: true + }); + return _this; + } + + return ExtendableError; +}(_extendableBuiltin(Error)); + +exports.default = ExtendableError; +module.exports = exports['default']; diff --git a/desktop/node_modules/es6-error/package.json b/desktop/node_modules/es6-error/package.json new file mode 100644 index 0000000..c5782a5 --- /dev/null +++ b/desktop/node_modules/es6-error/package.json @@ -0,0 +1,48 @@ +{ + "name": "es6-error", + "version": "4.1.1", + "description": "Easily-extendable error for use with ES6 classes", + "main": "./lib/index", + "module": "./es6/index.js", + "typings": "./typings/index.d.ts", + "files": [ + "lib", + "es6", + "typings" + ], + "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require babel-core/register --recursive", + "clean": "rimraf lib es6", + "build": "npm run clean && npm run build:cjs && npm run build:es6", + "build:cjs": "mkdir -p lib && cross-env BABEL_ENV=cjs babel src/index.js -o lib/index.js", + "build:es6": "mkdir -p es6 && cross-env BABEL_ENV=es6 babel src/index.js -o es6/index.js", + "prepublishOnly": "npm run build && npm run test" + }, + "repository": { + "type": "git", + "url": "https://github.com/bjyoungblood/es6-error.git" + }, + "keywords": [ + "es6", + "error", + "babel" + ], + "author": "Ben Youngblood", + "license": "MIT", + "bugs": { + "url": "https://github.com/bjyoungblood/es6-error/issues" + }, + "homepage": "https://github.com/bjyoungblood/es6-error", + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-transform-builtin-extend": "^1.1.2", + "babel-preset-env": "^1.6.1", + "chai": "^4.1.2", + "cross-env": "^5.1.1", + "mocha": "^4.0.1", + "rimraf": "^2.6.2" + }, + "dependencies": {} +} diff --git a/desktop/node_modules/es6-error/typings/index.d.ts b/desktop/node_modules/es6-error/typings/index.d.ts new file mode 100644 index 0000000..c1b1f12 --- /dev/null +++ b/desktop/node_modules/es6-error/typings/index.d.ts @@ -0,0 +1 @@ +export default class ExtendableError extends Error { } |