diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/is-error | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) | |
download | wallet-core-7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027.tar.xz |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/is-error')
-rw-r--r-- | node_modules/is-error/.jshintrc | 35 | ||||
-rw-r--r-- | node_modules/is-error/.npmignore | 64 | ||||
-rw-r--r-- | node_modules/is-error/.travis.yml | 7 | ||||
-rw-r--r-- | node_modules/is-error/LICENSE | 19 | ||||
-rw-r--r-- | node_modules/is-error/README.md | 54 | ||||
-rw-r--r-- | node_modules/is-error/index.js | 23 | ||||
-rw-r--r-- | node_modules/is-error/package.json | 51 | ||||
-rw-r--r-- | node_modules/is-error/test/index.js | 46 |
8 files changed, 299 insertions, 0 deletions
diff --git a/node_modules/is-error/.jshintrc b/node_modules/is-error/.jshintrc new file mode 100644 index 000000000..ac38a067e --- /dev/null +++ b/node_modules/is-error/.jshintrc @@ -0,0 +1,35 @@ +{ + "bitwise": false, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "forin": true, + "immed": true, + "indent": 4, + "latedef": "nofunc", + "newcap": true, + "noarg": true, + "nonew": true, + "plusplus": false, + "quotmark": false, + "regexp": false, + "undef": true, + "unused": true, + "strict": false, + "trailing": true, + "node": true, + "noempty": true, + "maxdepth": 4, + "maxparams": 4, + "newcap": false, + "globalstrict": true, + "shadow": "outer", + "globals": { + "console": true, + "Buffer": true, + "setTimeout": true, + "clearTimeout": true, + "setInterval": true, + "clearInterval": true + } +} diff --git a/node_modules/is-error/.npmignore b/node_modules/is-error/.npmignore new file mode 100644 index 000000000..41ae14d14 --- /dev/null +++ b/node_modules/is-error/.npmignore @@ -0,0 +1,64 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.a +*.o +*.so +*.node + +# Node Waf Byproducts # +####################### +.lock-wscript +build/ +autom4te.cache/ + +# Node Modules # +################ +# Better to let npm install these from the package.json defintion +# rather than maintain this manually +node_modules/ + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +dump.rdb +*.tap +*.xml + +# OS generated files # +###################### +.DS_Store? +.DS_Store +ehthumbs.db +Icon? +Thumbs.db +coverage + +# Text Editor Byproducts # +########################## +*.sw? +.idea/ + +# Python object code +########################## +*.py[oc] + +# All translation files # +######################### +static/translations-s3/ diff --git a/node_modules/is-error/.travis.yml b/node_modules/is-error/.travis.yml new file mode 100644 index 000000000..c6314e120 --- /dev/null +++ b/node_modules/is-error/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "0.8" + - "0.10" + - "0.11" +before_install: npm i npm@latest -g +script: npm run travis diff --git a/node_modules/is-error/LICENSE b/node_modules/is-error/LICENSE new file mode 100644 index 000000000..57dcbe348 --- /dev/null +++ b/node_modules/is-error/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 is-error. + +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/node_modules/is-error/README.md b/node_modules/is-error/README.md new file mode 100644 index 000000000..a16c59ac3 --- /dev/null +++ b/node_modules/is-error/README.md @@ -0,0 +1,54 @@ +# is-error + +<!-- + [![build status][build-png]][build] + [![Coverage Status][cover-png]][cover] + [![Davis Dependency status][dep-png]][dep] +--> + +<!-- [![NPM][npm-png]][npm] --> + +Detect whether a value is an error + +## Example + +```js +var isError = require("is-error"); + +console.log(isError(new Error('hi'))) // true +console.log(isError({ message: 'hi' })) // false +``` + +## Docs + +### `var bool = isError(maybeErr)` + +```hs +is-error := (maybeErr: Any) => Boolean +``` + +`isError` returns a boolean. it will detect whether the argument +is an error or not. + +## Installation + +`npm install is-error` + +## Tests + +`npm test` + +## Contributors + + - Raynos + +## MIT Licensed + + [build-png]: https://secure.travis-ci.org/Raynos/is-error.png + [build]: https://travis-ci.org/Raynos/is-error + [cover-png]: https://coveralls.io/repos/Raynos/is-error/badge.png + [cover]: https://coveralls.io/r/Raynos/is-error + [dep-png]: https://david-dm.org/Raynos/is-error.png + [dep]: https://david-dm.org/Raynos/is-error + [npm-png]: https://nodei.co/npm/is-error.png?stars&downloads + [npm]: https://nodei.co/npm/is-error diff --git a/node_modules/is-error/index.js b/node_modules/is-error/index.js new file mode 100644 index 000000000..c0b4dbeab --- /dev/null +++ b/node_modules/is-error/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var objectToString = Object.prototype.toString; +var getPrototypeOf = Object.getPrototypeOf; +var ERROR_TYPE = '[object Error]'; + +module.exports = function isError(err) { + if (typeof err !== 'object') { + return false; + } + if (err instanceof Error) { + // Accept `AssertionError`s from the `assert` module that ships + // with Node.js v6.1.0, compare issue #4. + return true; + } + while (err) { + if (objectToString.call(err) === ERROR_TYPE) { + return true; + } + err = getPrototypeOf(err); + } + return false; +}; diff --git a/node_modules/is-error/package.json b/node_modules/is-error/package.json new file mode 100644 index 000000000..29d78da92 --- /dev/null +++ b/node_modules/is-error/package.json @@ -0,0 +1,51 @@ +{ "name": "is-error", + "version": "2.2.1", + "description": "Detect whether a value is an error", + "keywords": [], + "author": "Raynos <raynos2@gmail.com>", + "repository": "git://github.com/mk-pmb/is-error-js.git", + "main": "index", + "homepage": "https://github.com/mk-pmb/is-error-js", + "bugs": { + "url": "https://github.com/mk-pmb/is-error-js/issues", + "email": "raynos2@gmail.com" + }, + "contributors": [ + { + "name": "Raynos" + } + ], + "dependencies": {}, + "devDependencies": { + "coveralls": "^2.10.0", + "istanbul": "^0.3.5", + "lint-trap": "^1.0.0", + "opn": "^1.0.1", + "pre-commit": "0.0.11", + "tap-spec": "^2.1.1", + "tape": "^3.4.0" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/mk-pmb/is-error-js/raw/master/LICENSE" + } + ], + "scripts": { + "test": "npm run jshint -s && npm run cover -s", + "unit-test": "node test/index.js | tap-spec", + "jshint": "lint-trap .", + "cover": "istanbul cover --report html --print detail -- test/index.js && npm run check-cover -s", + "check-cover": "istanbul check-coverage --branches=100 --lines=100 --functions=100", + "view-cover": "opn ./coverage/index.html", + "travis": "npm run cover -s && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)" + }, + "engine": { + "node": ">= 0.8.x" + }, + "pre-commit": [ + "test" + ], + "pre-commit.silent": true, + "ngen-version": "5.1.0" +} diff --git a/node_modules/is-error/test/index.js b/node_modules/is-error/test/index.js new file mode 100644 index 000000000..e20a2f719 --- /dev/null +++ b/node_modules/is-error/test/index.js @@ -0,0 +1,46 @@ +'use strict'; + +var test = require('tape'); +var vm = require('vm'); + +var isError = require('../index.js'); + +test('isError is a function', function t(assert) { + assert.equal(typeof isError, 'function'); + assert.end(); +}); + +test('returns true for error', function t(assert) { + assert.equal(isError(new Error('foo')), true); + assert.equal(isError(Error('foo')), true); + assert.end(); +}); + +test('returns false for non-error', function t(assert) { + assert.equal(isError(null), false); + assert.equal(isError(undefined), false); + assert.equal(isError({message: 'hi'}), false); + assert.equal(isError(true), false); + assert.equal(isError(false), false); + assert.equal(isError(1), false); + assert.equal(isError('string'), false); + assert.end(); +}); + +test('errors that inherit from Error', function t(assert) { + var error = Object.create(new Error()); + assert.equal(isError(error), true); + assert.end(); +}); + +test('errors from other contexts', function t(assert) { + var error = vm.runInNewContext('new Error()'); + assert.equal(isError(error), true); + assert.end(); +}); + +test('errors that inherit from Error in another context', function t(assert) { + var error = vm.runInNewContext('Object.create(new Error())'); + assert.equal(isError(error), true); + assert.end(); +}); |