Update gitignore (sorry)
This commit is contained in:
parent
a8f8c4d7ad
commit
cca8b02fea
6604 changed files with 1219661 additions and 4 deletions
36
electron/node_modules/ensure-error/index.d.ts
generated
vendored
Normal file
36
electron/node_modules/ensure-error/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
declare namespace ensureError {
|
||||
interface NonError extends Error {
|
||||
name: 'NonError';
|
||||
}
|
||||
}
|
||||
|
||||
// IfAny<T, ThenType, ElseType> resolves to ThenType if T is `any` and resolves to ElseType otherwise
|
||||
// https://stackoverflow.com/a/49928360/4135063
|
||||
type IfAny<T, ThenType, ElseType> = 0 extends (1 & T) ? ThenType : ElseType;
|
||||
|
||||
/**
|
||||
Ensures a value is a valid error by making it one if not.
|
||||
|
||||
If `input` is an `Error`, any missing `Error` properties will be added.
|
||||
If it's not an `Error`, `input` is converted to an `Error`.
|
||||
|
||||
@example
|
||||
```
|
||||
import ensureError = require('ensure-error');
|
||||
|
||||
const error = new TypeError('🦄');
|
||||
error.name = '';
|
||||
|
||||
console.log(error.name);
|
||||
//=> ''
|
||||
|
||||
console.log(ensureError(error).name);
|
||||
//=> 'TypeError'
|
||||
|
||||
console.log(ensureError(10));
|
||||
//=> [NonError: 10]
|
||||
```
|
||||
*/
|
||||
declare function ensureError<T>(input: T): IfAny<T, Error, T extends Error ? T : ensureError.NonError>;
|
||||
|
||||
export = ensureError;
|
||||
32
electron/node_modules/ensure-error/index.js
generated
vendored
Normal file
32
electron/node_modules/ensure-error/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
const util = require('util');
|
||||
|
||||
class NonError extends Error {
|
||||
constructor(message) {
|
||||
super(util.inspect(message));
|
||||
this.name = 'NonError';
|
||||
Error.captureStackTrace(this, NonError);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = input => {
|
||||
if (!(input instanceof Error)) {
|
||||
return new NonError(input);
|
||||
}
|
||||
|
||||
const error = input;
|
||||
|
||||
if (!error.name) {
|
||||
error.name = (error.constructor && error.constructor.name) || 'Error';
|
||||
}
|
||||
|
||||
if (!error.message) {
|
||||
error.message = '<No error message>';
|
||||
}
|
||||
|
||||
if (!error.stack) {
|
||||
error.stack = (new Error(error.message)).stack.replace(/\n {4}at /, '\n<Original stack missing>$&');
|
||||
}
|
||||
|
||||
return error;
|
||||
};
|
||||
9
electron/node_modules/ensure-error/license
generated
vendored
Normal file
9
electron/node_modules/ensure-error/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
41
electron/node_modules/ensure-error/package.json
generated
vendored
Normal file
41
electron/node_modules/ensure-error/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "ensure-error",
|
||||
"version": "2.1.0",
|
||||
"description": "Ensures a value is a valid error by making it one if not",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/ensure-error",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"error",
|
||||
"ensure",
|
||||
"valid",
|
||||
"stack",
|
||||
"message",
|
||||
"name",
|
||||
"string",
|
||||
"to",
|
||||
"make",
|
||||
"fix",
|
||||
"clean",
|
||||
"convert"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
55
electron/node_modules/ensure-error/readme.md
generated
vendored
Normal file
55
electron/node_modules/ensure-error/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# ensure-error [](https://travis-ci.org/sindresorhus/ensure-error)
|
||||
|
||||
> Ensures a value is a valid error by making it one if not
|
||||
|
||||
Pass it any value and you're are guaranteed to get back an `Error` with `name`, `message`, and `stack` properties.
|
||||
|
||||
Can be useful when you don't control all the places an error can be thrown or rejected. A user could for example throw a string or an error without a `stack` property.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ensure-error
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ensureError = require('ensure-error');
|
||||
|
||||
const error = new TypeError('🦄');
|
||||
error.name = '';
|
||||
|
||||
console.log(error.name);
|
||||
//=> ''
|
||||
|
||||
console.log(ensureError(error).name);
|
||||
//=> 'TypeError'
|
||||
```
|
||||
|
||||
```js
|
||||
const ensureError = require('ensure-error');
|
||||
|
||||
console.log(ensureError(10));
|
||||
//=> [NonError: 10]
|
||||
```
|
||||
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### ensureError(input)
|
||||
|
||||
If `input` is an `Error`, any missing `Error` properties will be added.<br>
|
||||
If it's not an `Error`, `input` is converted to an `Error`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `unknown`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Loading…
Add table
Add a link
Reference in a new issue