diff options
Diffstat (limited to 'tools/eslint/node_modules/fast-deep-equal')
5 files changed, 222 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/fast-deep-equal/.eslintrc.yml b/tools/eslint/node_modules/fast-deep-equal/.eslintrc.yml new file mode 100644 index 0000000000..14ab1fb978 --- /dev/null +++ b/tools/eslint/node_modules/fast-deep-equal/.eslintrc.yml @@ -0,0 +1,25 @@ +env: + node: true +extends: 'eslint:recommended' +rules: + indent: [ 2, 2, { SwitchCase: 1 } ] + no-trailing-spaces: 2 + quotes: [ 2, single, avoid-escape ] + linebreak-style: [ 2, unix ] + semi: [ 2, always ] + valid-jsdoc: [ 2, { requireReturn: false } ] + no-invalid-this: 2 + no-unused-vars: [ 2, { args: none } ] + no-console: [ 2, { allow: [ warn, error ] } ] + block-scoped-var: 2 + curly: [ 2, multi-or-nest, consistent ] + dot-location: [ 2, property ] + dot-notation: 2 + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-return-assign: 2 + strict: [ 2, global ] + no-use-before-define: [ 2, nofunc ] + callback-return: 2 + no-path-concat: 2 diff --git a/tools/eslint/node_modules/fast-deep-equal/LICENSE b/tools/eslint/node_modules/fast-deep-equal/LICENSE new file mode 100644 index 0000000000..7f1543566f --- /dev/null +++ b/tools/eslint/node_modules/fast-deep-equal/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +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/tools/eslint/node_modules/fast-deep-equal/README.md b/tools/eslint/node_modules/fast-deep-equal/README.md new file mode 100644 index 0000000000..ee83edd454 --- /dev/null +++ b/tools/eslint/node_modules/fast-deep-equal/README.md @@ -0,0 +1,55 @@ +# fast-deep-equal +The fastest deep equal + +[](https://travis-ci.org/epoberezkin/fast-deep-equal) +[](http://badge.fury.io/js/fast-deep-equal) +[](https://coveralls.io/github/epoberezkin/fast-deep-equal?branch=master) + + +## Install + +```bash +npm install fast-deep-equal +``` + + +## Features + +- ES5 compatible +- works in node.js (0.10+) and browsers (IE9+) +- checks equality of Date and RegExp objects by value. + + +## Usage + +```javascript +var equal = require('fast-deep-equal'); +console.log(equal({foo: 'bar'}, {foo: 'bar'})); // true +``` + + +## Performance benchmark + +``` +fast-deep-equal x 82,915 ops/sec ±0.63% (89 runs sampled) +nano-equal x 50,506 ops/sec ±2.23% (86 runs sampled) +shallow-equal-fuzzy x 14,873 ops/sec ±3.19% (83 runs sampled) +underscore.isEqual x 16,055 ops/sec ±2.29% (85 runs sampled) +lodash.isEqual x 10,740 ops/sec ±1.04% (89 runs sampled) +deep-equal x 12,276 ops/sec ±2.44% (84 runs sampled) +deep-eql x 10,565 ops/sec ±0.89% (90 runs sampled) +assert.deepStrictEqual x 965 ops/sec ±2.99% (81 runs sampled) +The fastest is fast-deep-equal +``` + +To run benchmark (requires node.js 6+): + +```bash +npm install +node benchmark +``` + + +## License + +[MIT](https://github.com/epoberezkin/fast-deep-equal/blob/master/LICENSE) diff --git a/tools/eslint/node_modules/fast-deep-equal/index.js b/tools/eslint/node_modules/fast-deep-equal/index.js new file mode 100644 index 0000000000..a29572d71d --- /dev/null +++ b/tools/eslint/node_modules/fast-deep-equal/index.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = function equal(a, b) { + if (a === b) return true; + + var arrA = Array.isArray(a) + , arrB = Array.isArray(b) + , i; + + if (arrA && arrB) { + if (a.length != b.length) return false; + for (i = 0; i < a.length; i++) + if (!equal(a[i], b[i])) return false; + return true; + } + + if (arrA != arrB) return false; + + if (a && b && typeof a === 'object' && typeof b === 'object') { + var keys = Object.keys(a); + if (keys.length !== Object.keys(b).length) return false; + + var dateA = a instanceof Date + , dateB = b instanceof Date; + if (dateA && dateB) return a.getTime() == b.getTime(); + if (dateA != dateB) return false; + + var regexpA = a instanceof RegExp + , regexpB = b instanceof RegExp; + if (regexpA && regexpB) return a.toString() == b.toString(); + if (regexpA != regexpB) return false; + + for (i = 0; i < keys.length; i++) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = 0; i < keys.length; i++) + if(!equal(a[keys[i]], b[keys[i]])) return false; + + return true; + } + + return false; +}; diff --git a/tools/eslint/node_modules/fast-deep-equal/package.json b/tools/eslint/node_modules/fast-deep-equal/package.json new file mode 100644 index 0000000000..7a5f273a80 --- /dev/null +++ b/tools/eslint/node_modules/fast-deep-equal/package.json @@ -0,0 +1,78 @@ +{ + "_from": "fast-deep-equal@^1.0.0", + "_id": "fast-deep-equal@1.0.0", + "_inBundle": false, + "_integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "_location": "/eslint/fast-deep-equal", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "fast-deep-equal@^1.0.0", + "name": "fast-deep-equal", + "escapedName": "fast-deep-equal", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/eslint/ajv" + ], + "_resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "_shasum": "96256a3bc975595eb36d82e9929d060d893439ff", + "_spec": "fast-deep-equal@^1.0.0", + "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/ajv", + "author": { + "name": "Evgeny Poberezkin" + }, + "bugs": { + "url": "https://github.com/epoberezkin/fast-deep-equal/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Fast deep equal", + "devDependencies": { + "benchmark": "^2.1.4", + "coveralls": "^2.13.1", + "deep-eql": "^2.0.2", + "deep-equal": "^1.0.1", + "eslint": "^4.0.0", + "lodash": "^4.17.4", + "mocha": "^3.4.2", + "nano-equal": "^1.0.1", + "nyc": "^11.0.2", + "pre-commit": "^1.2.2", + "shallow-equal-fuzzy": "0.0.2", + "underscore": "^1.8.3" + }, + "homepage": "https://github.com/epoberezkin/fast-deep-equal#readme", + "keywords": [ + "fast", + "equal", + "deep-equal" + ], + "license": "MIT", + "main": "index.js", + "name": "fast-deep-equal", + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/fast-deep-equal.git" + }, + "scripts": { + "eslint": "eslint *.js benchmark spec", + "test": "npm run eslint && npm run test-cov", + "test-cov": "nyc npm run test-spec", + "test-spec": "mocha spec/*.spec.js -R spec" + }, + "version": "1.0.0" +} |