This commit is contained in:
oitsjustjose 2017-02-26 17:06:42 -05:00
commit 6b60015c02
9588 changed files with 1149251 additions and 49 deletions

125
node_modules/make-error/README.md generated vendored Normal file
View file

@ -0,0 +1,125 @@
# make-error
[![Build Status](https://img.shields.io/travis/JsCommunity/make-error/master.svg)](http://travis-ci.org/JsCommunity/make-error)
[![Dependency Status](https://david-dm.org/JsCommunity/make-error/status.svg?theme=shields.io)](https://david-dm.org/JsCommunity/make-error)
[![devDependency Status](https://david-dm.org/JsCommunity/make-error/dev-status.svg?theme=shields.io)](https://david-dm.org/JsCommunity/make-error#info=devDependencies)
> Make your own error types!
## Features
- Compatible Node & browsers
- `instanceof` support
- `error.name` & `error.stack` support
- compatible with [CSP](https://en.wikipedia.org/wiki/Content_Security_Policy) (i.e. no `eval()`)
## Installation
### Node & Browserify
Installation of the [npm package](https://npmjs.org/package/make-error):
```
> npm install --save make-error
```
Then require the package:
```javascript
var makeError = require('make-error');
```
### Browser
Clone the git repository and compile the browser version of the
library:
```
> git clone https://github.com/JsCommunity/make-error.git
> npm install
> npm run browserify
```
Then import the script `make-error.js` which has been compiled in the
`dist/` directory:
```html
<script src="make-error.js"></script>
```
## Usage
### Basic named error
```javascript
var CustomError = makeError('CustomError')
// Parameters are forwarded to the super class (here Error).
throw new CustomError('a message')
```
### Advanced error class
```javascript
function CustomError (customValue) {
CustomError.super.call(this, 'custom error message')
this.customValue = customValue
}
makeError(CustomError)
// Feel free to extend the prototype.
CustomError.prototype.myMethod = function CustomError$myMethod () {
console.log('CustomError.myMethod (%s, %s)', this.code, this.message)
}
//-----
try {
throw new CustomError(42)
} catch (error) {
error.myMethod()
}
```
### Specialized error
```javascript
var SpecializedError = makeError('SpecializedError', CustomError);
throw new SpecializedError(42);
```
### Inheritance
> Best for ES6.
```javascript
import {BaseError} from 'make-error'
class CustomError extends BaseError {
constructor () {
super('custom error message')
}
}
```
## Related
- [make-error-cause](https://www.npmjs.com/package/make-error-cause): Make your own error types, with a cause!
## Contributions
Contributions are *very* welcomed, either on the documentation or on
the code.
You may:
- report any [issue](https://github.com/JsCommunity/make-error/issues)
you've encountered;
- fork and create a pull request.
## License
ISC © [Julien Fontanet](http://julien.isonoe.net)

35
node_modules/make-error/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,35 @@
/**
* Create a new error constructor instance.
*/
declare function makeError(name: string): makeError.Constructor<makeError.BaseError>;
/**
* Set the constructor prototype to `BaseError`.
*/
declare function makeError<T extends Error>(super_: { new (...args: any[]): T }): makeError.Constructor<T & makeError.BaseError>;
/**
* Create a specialized error instance.
*/
declare function makeError<T extends Error>(name: string | Function, super_: { new (...args: any[]): T }): makeError.Constructor<T>;
declare module makeError {
/**
* Use with ES6 inheritance.
*/
export class BaseError implements Error {
message: string;
name: string;
stack: string;
constructor(message: string);
}
export interface Constructor <T> {
new (message: string): T
super_: any
prototype: T
}
}
export = makeError;

142
node_modules/make-error/index.js generated vendored Normal file
View file

@ -0,0 +1,142 @@
// ISC @ Julien Fontanet
'use strict'
// ===================================================================
var defineProperty = Object.defineProperty
// -------------------------------------------------------------------
var captureStackTrace = Error.captureStackTrace
if (!captureStackTrace) {
captureStackTrace = function captureStackTrace (error) {
var container = new Error()
defineProperty(error, 'stack', {
configurable: true,
get: function getStack () {
var stack = container.stack
// Replace property with value for faster future accesses.
defineProperty(this, 'stack', {
value: stack
})
return stack
},
set: function setStack (stack) {
defineProperty(error, 'stack', {
configurable: true,
value: stack,
writable: true
})
}
})
}
}
// -------------------------------------------------------------------
function BaseError (message) {
if (message) {
defineProperty(this, 'message', {
configurable: true,
value: message,
writable: true
})
}
var cname = this.constructor.name
if (
cname &&
cname !== this.name
) {
defineProperty(this, 'name', {
configurable: true,
value: cname,
writable: true
})
}
captureStackTrace(this, this.constructor)
}
BaseError.prototype = Object.create(Error.prototype, {
// See: https://github.com/JsCommunity/make-error/issues/4
constructor: {
configurable: true,
value: BaseError,
writable: true
}
})
// -------------------------------------------------------------------
// Sets the name of a function if possible (depends of the JS engine).
var setFunctionName = (function () {
function setFunctionName (fn, name) {
return defineProperty(fn, 'name', {
configurable: true,
value: name
})
}
try {
var f = function () {}
setFunctionName(f, 'foo')
if (f.name === 'foo') {
return setFunctionName
}
} catch (_) {}
})()
// -------------------------------------------------------------------
function makeError (constructor, super_) {
if (super_ == null || super_ === Error) {
super_ = BaseError
} else if (typeof super_ !== 'function') {
throw new TypeError('super_ should be a function')
}
var name
if (typeof constructor === 'string') {
name = constructor
constructor = function () { super_.apply(this, arguments) }
// If the name can be set, do it once and for all.
if (setFunctionName) {
setFunctionName(constructor, name)
name = null
}
} else if (typeof constructor !== 'function') {
throw new TypeError('constructor should be either a string or a function')
}
// Also register the super constructor also as `constructor.super_` just
// like Node's `util.inherits()`.
constructor.super_ = constructor['super'] = super_
var properties = {
constructor: {
configurable: true,
value: constructor,
writable: true
}
}
// If the name could not be set on the constructor, set it on the
// prototype.
if (name != null) {
properties.name = {
configurable: true,
value: name,
writable: true
}
}
constructor.prototype = Object.create(super_.prototype, properties)
return constructor
}
exports = module.exports = makeError
exports.BaseError = BaseError

117
node_modules/make-error/package.json generated vendored Normal file
View file

@ -0,0 +1,117 @@
{
"_args": [
[
{
"raw": "make-error@^1.2.0",
"scope": null,
"escapedName": "make-error",
"name": "make-error",
"rawSpec": "^1.2.0",
"spec": ">=1.2.0 <2.0.0",
"type": "range"
},
"/Users/jose/Documents/GitHub/Mods/node_modules/make-error-cause"
]
],
"_from": "make-error@>=1.2.0 <2.0.0",
"_id": "make-error@1.2.1",
"_inCache": true,
"_location": "/make-error",
"_nodeVersion": "0.12.15",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/make-error-1.2.1.tgz_1473148018649_0.09818827407434583"
},
"_npmUser": {
"name": "julien-f",
"email": "julien.fontanet@isonoe.net"
},
"_npmVersion": "3.10.6",
"_phantomChildren": {},
"_requested": {
"raw": "make-error@^1.2.0",
"scope": null,
"escapedName": "make-error",
"name": "make-error",
"rawSpec": "^1.2.0",
"spec": ">=1.2.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/make-error-cause"
],
"_resolved": "https://registry.npmjs.org/make-error/-/make-error-1.2.1.tgz",
"_shasum": "9a6dfb4844423b9f145806728d05c6e935670e75",
"_shrinkwrap": null,
"_spec": "make-error@^1.2.0",
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/make-error-cause",
"author": {
"name": "Julien Fontanet",
"email": "julien.fontanet@isonoe.net"
},
"bugs": {
"url": "https://github.com/JsCommunity/make-error/issues"
},
"dependencies": {},
"description": "Make your own error types!",
"devDependencies": {
"browserify": "^13.0.0",
"chai": "^3.3.0",
"mocha": "^3.0.0",
"standard": "^8.0.0",
"testling": "^1.7.1",
"uglify-js": "^2.4.19"
},
"directories": {},
"dist": {
"shasum": "9a6dfb4844423b9f145806728d05c6e935670e75",
"tarball": "https://registry.npmjs.org/make-error/-/make-error-1.2.1.tgz"
},
"files": [
"index.js",
"index.d.ts"
],
"gitHead": "da5f271700a1df98e7d25034f7aef6cb2d35a691",
"homepage": "https://github.com/JsCommunity/make-error",
"keywords": [
"custom",
"derive",
"Error",
"extend",
"inherit"
],
"license": "ISC",
"maintainers": [
{
"name": "julien-f",
"email": "julien.fontanet@isonoe.net"
},
{
"name": "marsaud",
"email": "marsaud.fabrice@neuf.fr"
}
],
"name": "make-error",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/JsCommunity/make-error.git"
},
"scripts": {
"browserify": "mkdir -p dist && browserify -s makeError index.js | uglifyjs -c > dist/make-error.js",
"dev-test": "mocha --watch --reporter=min index.spec.js",
"test": "standard && mocha index.spec.js",
"test-browser": "testling -u"
},
"testling": {
"harness": "mocha-bdd",
"files": "index.spec.js",
"browsers": [
"ie/8..Latest",
"chrome/latest",
"firefox/latest"
]
},
"version": "1.2.1"
}