react-fast-compare
Advanced tools
Comparing version 3.0.2 to 3.1.0
# Changelog | ||
## 3.1.0 (2020-05-08) | ||
- [#76](https://github.com/FormidableLabs/react-fast-compare/pull/76). Add support for preact/compat. | ||
- [#75](https://github.com/FormidableLabs/react-fast-compare/pull/75). Drop test support for Node 8. | ||
- [#62](https://github.com/FormidableLabs/react-fast-compare/pull/62). Fix TypeScript types by declaring a function instead of a module. | ||
## 3.0.2 (2020-05-01) | ||
@@ -4,0 +10,0 @@ |
@@ -1,4 +0,3 @@ | ||
declare module 'react-fast-compare' { | ||
const isEqual: (a: any, b: any) => boolean | ||
export default isEqual | ||
} | ||
declare function isEqual(a: any, b: any): boolean; | ||
declare namespace isEqual {} | ||
export = isEqual; |
16
index.js
@@ -91,9 +91,13 @@ /* global Map:readonly, Set:readonly, ArrayBuffer:readonly */ | ||
// custom handling for React | ||
// custom handling for React/Preact | ||
for (i = length; i-- !== 0;) { | ||
if (keys[i] === '_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 | ||
if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) { | ||
// React-specific: avoid traversing React elements' _owner | ||
// Preact-specific: avoid traversing Preact elements' __v and __o | ||
// __v = $_original / $_vnode | ||
// __o = $_owner | ||
// These properties contain circular references and are not needed when | ||
// comparing the actual elements (and not their owners) | ||
// .$$typeof and ._store on just reasonable markers of elements | ||
continue; | ||
@@ -100,0 +104,0 @@ } |
{ | ||
"name": "react-fast-compare", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Fastest deep equal comparison for React. Great for React.memo & shouldComponentUpdate. Also really fast general-purpose deep comparison.", | ||
@@ -13,3 +13,3 @@ "main": "index.js", | ||
"test-node": "mocha \"test/node/*.spec.js\"", | ||
"test-node-cov": "nyc yarn test-node", | ||
"test-node-cov": "nyc mocha \"test/node/*.spec.js\"", | ||
"test-ts": "tsc --target ES5 --noImplicitAny index.d.ts", | ||
@@ -42,10 +42,14 @@ "test": "builder concurrent --buffer eslint test-ts test-node-cov test-browser", | ||
"@babel/preset-env": "^7.7.6", | ||
"@testing-library/dom": "^7.5.1", | ||
"@testing-library/preact": "^1.0.2", | ||
"babel-loader": "^8.0.6", | ||
"benchmark": "^2.1.4", | ||
"builder": "^5.0.0", | ||
"codecov": "^3.6.5", | ||
"core-js": "^3.5.0", | ||
"coveralls": "^3.0.9", | ||
"eslint": "^6.7.2", | ||
"fast-deep-equal": "3.1.1", | ||
"fast-deep-equal-git": "epoberezkin/fast-deep-equal#v3.1.1", | ||
"jsdom": "^16.2.2", | ||
"jsdom-global": "^3.0.2", | ||
"karma": "^4.4.1", | ||
@@ -63,4 +67,5 @@ "karma-chrome-launcher": "^3.1.0", | ||
"nyc": "^14.1.1", | ||
"preact": "^10.4.1", | ||
"react": "^16.3.1", | ||
"react-test-renderer": "^16.3.1", | ||
"react-test-renderer": "^16.13.1", | ||
"shallow-equal-fuzzy": "0.0.2", | ||
@@ -67,0 +72,0 @@ "sinon": "^7.5.0", |
@@ -7,2 +7,3 @@ # react-fast-compare | ||
[![AppVeyor Status][appveyor_img]][appveyor_site] | ||
[![Coverage Status][cov_img]][cov_site] | ||
[![npm version][npm_img]][npm_site] | ||
@@ -18,3 +19,3 @@ [![Maintenance Status][maintenance_img]](#maintenance-status) | ||
![benchmark chart](assets/benchmarking.png "benchmarking chart") | ||
![benchmark chart](https://raw.githubusercontent.com/FormidableLabs/react-fast-compare/master/assets/benchmarking.png "benchmarking chart") | ||
@@ -159,4 +160,4 @@ (Check out the [benchmarking details](#benchmarking-this-library).) | ||
[trav_site]: https://travis-ci.com/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 | ||
[cov_img]: https://codecov.io/gh/FormidableLabs/react-fast-compare/branch/master/graph/badge.svg | ||
[cov_site]: https://codecov.io/gh/FormidableLabs/react-fast-compare | ||
[npm_img]: https://badge.fury.io/js/react-fast-compare.svg | ||
@@ -166,4 +167,4 @@ [npm_site]: http://badge.fury.io/js/react-fast-compare | ||
[appveyor_site]: https://ci.appveyor.com/project/FormidableLabs/react-fast-compare | ||
[bundle_img]: https://img.shields.io/badge/minzipped%20size-627%20B-flatgreen.svg | ||
[bundle_img]: https://img.shields.io/badge/minzipped%20size-639%20B-flatgreen.svg | ||
[downloads_img]: https://img.shields.io/npm/dm/react-fast-compare.svg | ||
[maintenance_img]: https://img.shields.io/badge/maintenance-active-flatgreen.svg |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17727
119
167
0
34