mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 05:32:18 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
22
web/node_modules/react-fast-compare/LICENSE
generated
vendored
Normal file
22
web/node_modules/react-fast-compare/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 Formidable Labs
|
||||
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.
|
141
web/node_modules/react-fast-compare/README.md
generated
vendored
Normal file
141
web/node_modules/react-fast-compare/README.md
generated
vendored
Normal file
|
@ -0,0 +1,141 @@
|
|||
# react-fast-compare
|
||||
|
||||
The fastest deep equal comparison for React. Really fast general-purpose deep comparison.
|
||||
Great for`shouldComponentUpdate`. This is a fork of the brilliant
|
||||
[fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) with some
|
||||
extra handling for React.
|
||||
|
||||
[![Travis Status][trav_img]][trav_site]
|
||||
[![AppVeyor Status][appveyor_img]][appveyor_site]
|
||||
[![npm version][npm_img]][npm_site]
|
||||
[![size_minzip][size_minzip]][size_site]
|
||||
[![size_min][size_min]][size_site]
|
||||
|
||||

|
||||
|
||||
(Check out the [benchmarking details](#benchmarking-this-library).)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ yarn add react-fast-compare
|
||||
# or
|
||||
$ npm install react-fast-compare
|
||||
```
|
||||
|
||||
## Highlights
|
||||
|
||||
* ES5 compatible; works in node.js (0.10+) and browsers (IE9+)
|
||||
* deeply compares any value (besides objects with circular references)
|
||||
* handles React-specific circular references, like elements
|
||||
* checks equality Date and RegExp objects
|
||||
* should be just as fast as [fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) for general use, and faster for React use
|
||||
* small: under 600 bytes minified+gzipped
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
const isEqual = require("react-fast-compare");
|
||||
|
||||
// general usage
|
||||
console.log(isEqual({ foo: "bar" }, { foo: "bar" })); // true
|
||||
|
||||
// react usage
|
||||
class ExpensiveRenderer extends React.Component {
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return !isEqual(this.props, nextProps);
|
||||
}
|
||||
render() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Do I Need `shouldComponentUpdate`?
|
||||
|
||||
> What's faster than a really fast deep comparison? No deep comparison at all.
|
||||
|
||||
—This Readme
|
||||
|
||||
Deep checks in React's `shouldComponentUpdate` should not be used blindly.
|
||||
First, see if a
|
||||
[PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
|
||||
would work for you. If it won't (if you need deep checks), it's wise to make
|
||||
sure you've correctly indentified the bottleneck in your application by
|
||||
[profiling the performance](https://reactjs.org/docs/optimizing-performance.html#profiling-components-with-the-chrome-performance-tab).
|
||||
After you've determined that you _do_ need deep equality checks and you've
|
||||
identified the minimum number of places to apply them, then this library may
|
||||
be for you! For more information about making your app faster, check out the
|
||||
[Optimizing Performance](https://reactjs.org/docs/optimizing-performance.html)
|
||||
section of the React docs.
|
||||
|
||||
## Benchmarking this Library
|
||||
|
||||
All tests carried out locally on a MacBook. The absolute values are much less
|
||||
important than the relative differences between packages.
|
||||
|
||||
Benchmarking source can be found
|
||||
[here](https://github.com/FormidableLabs/react-fast-compare/blob/master/node/tests.js).
|
||||
Each "operation" consists of running all relevant tests. The React benchmark
|
||||
uses both the generic tests and the react tests; these runs will be slower
|
||||
simply because there are more tests in each operation.
|
||||
|
||||
### Generic Data
|
||||
|
||||
```
|
||||
react-fast-compare x 207,503 ops/sec ±0.54% (92 runs sampled)
|
||||
fast-deep-equal x 195,006 ops/sec ±0.70% (91 runs sampled)
|
||||
lodash.isEqual x 43,778 ops/sec ±0.55% (91 runs sampled)
|
||||
nano-equal x 198,036 ops/sec ±0.37% (95 runs sampled)
|
||||
shallow-equal-fuzzy x 173,023 ops/sec ±0.59% (95 runs sampled)
|
||||
fastest: react-fast-compare
|
||||
```
|
||||
|
||||
`react-fast-compare` and `fast-deep-equal` should be the same speed for these
|
||||
tests; any difference is just noise. `react-fast-compare` won't be faster than
|
||||
`fast-deep-equal`, because it's based on it.
|
||||
|
||||
### React and Generic Data
|
||||
|
||||
```
|
||||
react-fast-compare x 187,628 ops/sec ±0.58% (93 runs sampled)
|
||||
fast-deep-equal x 477 ops/sec ±0.55% (91 runs sampled)
|
||||
lodash.isEqual x 35,100 ops/sec ±0.16% (95 runs sampled)
|
||||
nano-equal x 468 ops/sec ±0.53% (94 runs sampled)
|
||||
shallow-equal-fuzzy x 684 ops/sec ±0.43% (92 runs sampled)
|
||||
fastest: react-fast-compare
|
||||
```
|
||||
|
||||
Three of these packages cannot handle comparing React elements (which are
|
||||
circular): `fast-deep-equal`, `nano-equal`, and `shallow-equal-fuzzy`.
|
||||
|
||||
### Running Benchmarks
|
||||
|
||||
```sh
|
||||
$ yarn install
|
||||
$ yarn run benchmark
|
||||
```
|
||||
|
||||
## fast-deep-equal Versioning
|
||||
|
||||
react-fast-compare@2.0.0 tracks fast-deep-equal@2.0.1
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/FormidableLabs/react-fast-compare/blob/readme/LICENSE)
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see our [contributions guide](./CONTRIBUTING.md).
|
||||
|
||||
[trav_img]: https://api.travis-ci.org/FormidableLabs/react-fast-compare.svg
|
||||
[trav_site]: https://travis-ci.org/FormidableLabs/react-fast-compare
|
||||
[cov_img]: https://img.shields.io/coveralls/FormidableLabs/react-fast-compare.svg
|
||||
[cov_site]: https://coveralls.io/r/FormidableLabs/react-fast-compare
|
||||
[npm_img]: https://badge.fury.io/js/react-fast-compare.svg
|
||||
[npm_site]: http://badge.fury.io/js/react-fast-compare
|
||||
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/formidablelabs/react-fast-compare?branch=master&svg=true
|
||||
[appveyor_site]: https://ci.appveyor.com/project/FormidableLabs/react-fast-compare
|
||||
[size_min]: https://img.shields.io/bundlephobia/min/react-fast-compare.svg
|
||||
[size_minzip]: https://img.shields.io/bundlephobia/minzip/react-fast-compare.svg
|
||||
[size_site]: https://bundlephobia.com/result?p=react-fast-compare
|
4
web/node_modules/react-fast-compare/index.d.ts
generated
vendored
Normal file
4
web/node_modules/react-fast-compare/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
declare module 'react-fast-compare' {
|
||||
const equal: (a: any, b: any) => boolean;
|
||||
export = equal;
|
||||
}
|
94
web/node_modules/react-fast-compare/index.js
generated
vendored
Normal file
94
web/node_modules/react-fast-compare/index.js
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
'use strict';
|
||||
|
||||
var isArray = Array.isArray;
|
||||
var keyList = Object.keys;
|
||||
var hasProp = Object.prototype.hasOwnProperty;
|
||||
var hasElementType = typeof Element !== 'undefined';
|
||||
|
||||
function equal(a, b) {
|
||||
// fast-deep-equal index.js 2.0.1
|
||||
if (a === b) return true;
|
||||
|
||||
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
||||
var arrA = isArray(a)
|
||||
, arrB = isArray(b)
|
||||
, i
|
||||
, length
|
||||
, key;
|
||||
|
||||
if (arrA && arrB) {
|
||||
length = a.length;
|
||||
if (length != b.length) return false;
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!equal(a[i], b[i])) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arrA != arrB) return false;
|
||||
|
||||
var dateA = a instanceof Date
|
||||
, dateB = b instanceof Date;
|
||||
if (dateA != dateB) return false;
|
||||
if (dateA && dateB) return a.getTime() == b.getTime();
|
||||
|
||||
var regexpA = a instanceof RegExp
|
||||
, regexpB = b instanceof RegExp;
|
||||
if (regexpA != regexpB) return false;
|
||||
if (regexpA && regexpB) return a.toString() == b.toString();
|
||||
|
||||
var keys = keyList(a);
|
||||
length = keys.length;
|
||||
|
||||
if (length !== keyList(b).length)
|
||||
return false;
|
||||
|
||||
for (i = length; i-- !== 0;)
|
||||
if (!hasProp.call(b, keys[i])) return false;
|
||||
// end fast-deep-equal
|
||||
|
||||
// start react-fast-compare
|
||||
// custom handling for DOM elements
|
||||
if (hasElementType && a instanceof Element && b instanceof Element)
|
||||
return a === b;
|
||||
|
||||
// custom handling for React
|
||||
for (i = length; i-- !== 0;) {
|
||||
key = keys[i];
|
||||
if (key === '_owner' && a.$$typeof) {
|
||||
// React-specific: avoid traversing React elements' _owner.
|
||||
// _owner contains circular references
|
||||
// and is not needed when comparing the actual elements (and not their owners)
|
||||
// .$$typeof and ._store on just reasonable markers of a react element
|
||||
continue;
|
||||
} else {
|
||||
// all other properties should be traversed as usual
|
||||
if (!equal(a[key], b[key])) return false;
|
||||
}
|
||||
}
|
||||
// end react-fast-compare
|
||||
|
||||
// fast-deep-equal index.js 2.0.1
|
||||
return true;
|
||||
}
|
||||
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
// end fast-deep-equal
|
||||
|
||||
module.exports = function exportedEqual(a, b) {
|
||||
try {
|
||||
return equal(a, b);
|
||||
} catch (error) {
|
||||
if ((error.message && error.message.match(/stack|recursion/i)) || (error.number === -2146828260)) {
|
||||
// warn on circular references, don't crash
|
||||
// browsers give this different errors name and messages:
|
||||
// chrome/safari: "RangeError", "Maximum call stack size exceeded"
|
||||
// firefox: "InternalError", too much recursion"
|
||||
// edge: "Error", "Out of stack space"
|
||||
console.warn('Warning: react-fast-compare does not handle circular references.', error.name, error.message);
|
||||
return false;
|
||||
}
|
||||
// some other error. we should definitely know about these
|
||||
throw error;
|
||||
}
|
||||
};
|
80
web/node_modules/react-fast-compare/package.json
generated
vendored
Normal file
80
web/node_modules/react-fast-compare/package.json
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "react-fast-compare",
|
||||
"version": "2.0.4",
|
||||
"description": "Fastest deep equal comparison for React. Perfect for shouldComponentUpdate. Also really fast general-purpose deep comparison",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"preversion": "npm run test",
|
||||
"benchmark": "node benchmark",
|
||||
"eslint": "eslint \"*.js\" benchmark test",
|
||||
"test-browser": "karma start test/browser/karma.conf.js",
|
||||
"test-browser-ie": "karma start test/browser/karma.conf.ie.js",
|
||||
"test-node": "mocha \"test/node/*.spec.js\"",
|
||||
"test-node-cov": "nyc npm run test-node",
|
||||
"test-ts": "tsc --target ES5 --noImplicitAny index.d.ts",
|
||||
"test": "builder concurrent --buffer eslint test-ts test-node-cov test-browser",
|
||||
"test-ie": "builder concurrent --buffer eslint test-ts test-node-cov test-browser-ie"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/FormidableLabs/react-fast-compare.git"
|
||||
},
|
||||
"keywords": [
|
||||
"fast",
|
||||
"equal",
|
||||
"react",
|
||||
"compare",
|
||||
"shouldComponentUpdate",
|
||||
"deep-equal"
|
||||
],
|
||||
"author": "Chris Bolin",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/FormidableLabs/react-fast-compare/issues"
|
||||
},
|
||||
"homepage": "https://github.com/FormidableLabs/react-fast-compare",
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"builder": "^4.0.0",
|
||||
"core-js": "^2.5.5",
|
||||
"coveralls": "^2.13.1",
|
||||
"eslint": "^4.0.0",
|
||||
"fast-deep-equal": "2.0.1",
|
||||
"karma": "^2.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-ie-launcher": "^1.0.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"lodash": "^4.17.10",
|
||||
"mocha": "^3.4.2",
|
||||
"nano-equal": "^2.0.2",
|
||||
"nyc": "^11.0.2",
|
||||
"react": "^16.3.1",
|
||||
"react-test-renderer": "^16.3.1",
|
||||
"shallow-equal-fuzzy": "0.0.2",
|
||||
"sinon": "^4.5.0",
|
||||
"typescript": "^2.6.1",
|
||||
"webpack": "^4.5.0"
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"**/test/**",
|
||||
"node_modules"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"types": "index.d.ts"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue