{"_id":"react-fast-compare@3.2.4","bugs":{"url":"https://github.com/FormidableLabs/react-fast-compare/issues"},"dist":{"shasum":"b9d457ef9b2fea716dc31c9cec20901ccd0bf203","tarball":"http://registry-npm.ywwl.com/react-fast-compare/download/react-fast-compare-3.2.4.tgz","fileCount":5,"integrity":"sha512-YbkgZfjvuokdt6zR8Oki8Bt4QXAZim/9HKSUr5J23GVyX2o8sYD/JlKSFrJvEFIPjotWvkGY7DgUS+udyr8cEw==","signatures":[{"sig":"MEUCIDv7f1xPXkzFN37Ldrbhh66qowfrTVOVbUilCWcIDuBBAiEA+A568Y3w+rE0vHheEvINjdeGwGEmya/0BbBnxblffk8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFhI0p/Ss40hPK+9/KQbpfa3+0YrCihEtctFehKwevtwAiEAg9zPcjB9JES9pPTTpDkDligwwnbXztP+rk7emf2qxJg="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/react-fast-compare@3.2.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":15517,"size":6035,"noattachment":false,"key":"/react-fast-compare/-/react-fast-compare-3.2.4.tgz"},"main":"index.js","name":"react-fast-compare","types":"index.d.ts","author":"Chris Bolin","license":"MIT","scripts":{"lint":"oxlint --report-unused-disable-directives-severity=error","size":"node scripts/size.mjs","test":"vitest run","bench":"vitest bench --run --project \"node (bench)\" --reporter=default --reporter=./bench/summary-reporter.mjs","check":"pnpm format && pnpm lint && pnpm lint:gha && pnpm types:check && pnpm test && pnpm pack:check","format":"oxfmt --check","lint:fix":"oxlint --report-unused-disable-directives-severity=error --fix","lint:gha":"node scripts/lint-gha.mjs","changeset":"changeset","dep:check":"ncu","format:fix":"oxfmt","pack:check":"node scripts/pack-check.mjs","types:check":"node scripts/types-check.mjs"},"typings":"index.d.ts","version":"3.2.4","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"1742f2e9-4bf6-4414-91bf-260972922992"}},"homepage":"https://github.com/FormidableLabs/react-fast-compare","keywords":["fast","equal","react","compare","shouldComponentUpdate","deep-equal"],"repository":{"url":"https://github.com/FormidableLabs/react-fast-compare","type":"git"},"description":"Fastest deep equal comparison for React. Great for React.memo & shouldComponentUpdate. Also really fast general-purpose deep comparison.","directories":{},"maintainers":[{"name":"sarmeyer","email":"sarahmichelleegan@gmail.com"},{"name":"mariano-formidable","email":"mariano.martinez@formidable.com"},{"name":"ryan.roemer","email":"ryan@loose-bits.com"},{"name":"formidable-owner","email":"npm+formidable-owner@formidablelabs.com"},{"name":"formidablelabs","email":"npm@formidablelabs.com"},{"name":"sarahformidable","email":"sarah.wright@formidable.com"},{"name":"ceceppa","email":"senesealessandro@gmail.com"}],"sideEffects":false,"_hasShrinkwrap":false,"devDependencies":{"jsdom":"^30.1.3","oxfmt":"0.75.0","react":"^19.3.1","oxlint":"1.90.0","preact":"^11.1.1","terser":"5.51.2","vitest":"^5.1.0","publint":"0.3.25","react-dom":"^19.3.1","playwright":"^1.64.1","typescript":"7.0.2","@types/react":"^19.3.0","@changesets/cli":"^3.0.3","fast-deep-equal":"3.1.3","npm-check-updates":"^23.1.1","@vitest/coverage-v8":"^5.1.0","@arethetypeswrong/cli":"0.18.5","@vitest/browser-playwright":"^5.1.0","@changesets/changelog-github":"^1.0.1","react-fast-compare-published":"npm:react-fast-compare@3.2.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-fast-compare_3.2.4_1795205762263_0.16971276063908236"},"readme":"[![React Fast Compare — Nearform](https://oss.nearform.com/api/banner.svg?badge=react-fast-compare&bg=2f8f83)](https://nearform.com/open-source/)\n\n[![Downloads][downloads_img]][npm_site]\n[![GH Actions Status][actions_img]][actions_site]\n[![npm version][npm_img]][npm_site]\n[![Maintenance Status][maintenance_img]](#maintenance-status)\n\nThe fastest deep equal comparison for React. Very quick general-purpose deep\ncomparison, too. Great for `React.memo` and `shouldComponentUpdate`.\n\nThis is a fork of the brilliant\n[fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) with some\nextra handling for React.\n\n## Install\n\n```sh\n$ npm install react-fast-compare\n```\n\n## Highlights\n\n- ES5 compatible; works in node.js (0.10+) and browsers (IE9+)\n- deeply compares any value (besides objects with circular references)\n- handles React-specific circular references, like elements\n- checks equality of Date and RegExp objects\n- should be as fast as [fast-deep-equal](https://github.com/epoberezkin/fast-deep-equal) via a single unified library, and with added guardrails for circular references.\n- small: under 850 bytes minified+gzipped\n\n## Usage\n\n```jsx\nconst isEqual = require('react-fast-compare');\n\n// general usage\nconsole.log(isEqual({ foo: 'bar' }, { foo: 'bar' })); // true\n\n// React.memo\n// only re-render ExpensiveComponent when the props have deeply changed\nconst DeepMemoComponent = React.memo(ExpensiveComponent, isEqual);\n\n// React.Component shouldComponentUpdate\n// only re-render AnotherExpensiveComponent when the props have deeply changed\nclass AnotherExpensiveComponent extends React.Component {\n  shouldComponentUpdate(nextProps) {\n    return !isEqual(this.props, nextProps);\n  }\n  render() {\n    // ...\n  }\n}\n```\n\n## Do I Need `React.memo` (or `shouldComponentUpdate`)?\n\n> What's faster than a really fast deep comparison? No deep comparison at all.\n\n—This Readme\n\nDeep checks in `React.memo` or a `shouldComponentUpdate` should not be used blindly.\nFirst, see if the default\n[React.memo](https://react.dev/reference/react/memo) or\n[PureComponent](https://react.dev/reference/react/PureComponent)\nwill work for you. If it won't (if you need deep checks), it's wise to make\nsure you've correctly identified the bottleneck in your application by\n[profiling the performance](https://react.dev/reference/react/Profiler).\nAfter you've determined that you _do_ need deep equality checks and you've\nidentified the minimum number of places to apply them, then this library may\nbe for you!\n\n## Benchmarking this Library\n\n`react-fast-compare` is based on `fast-deep-equal`, and aims to be as fast on\ngeneric data while also handling React elements. The benchmark\n([`bench/`](./bench/compare.bench.mjs), Vitest's\n[benchmarking](https://vitest.dev/guide/benchmarking)) compares this code with\nthe last published version and with `fast-deep-equal`, over the same test cases\nthe tests use:\n\n```sh\n$ pnpm install\n$ pnpm bench\n```\n\nAbsolute numbers depend on the machine; compare rows from the same run. CI adds\nthe results to the job summary of each run.\n\n## Differences between this library and `fast-deep-equal`\n\n`react-fast-compare` is based on `fast-deep-equal`, with some additions:\n\n- `react-fast-compare` has `try`/`catch` guardrails for stack overflows from undetected (non-React) circular references.\n- `react-fast-compare` has a _single_ unified entry point for all uses. No matter what your target application is, `import equal from 'react-fast-compare'` just works. `fast-deep-equal` has multiple entry points for different use cases.\n\nThis version of `react-fast-compare` tracks `fast-deep-equal@3.1.3`.\n\n## Bundle Size\n\nThere are a variety of ways to calculate bundle size for JavaScript code.\n`pnpm size` ([`scripts/size.mjs`](./scripts/size.mjs)) minifies `index.js` with\nterser, mangling top-level names, and reports the raw, minified, gzip and\nbrotli sizes. CI adds the same report to each run's job summary.\n[Bundlephobia's calculation](https://bundlephobia.com/result?p=react-fast-compare) is slightly higher,\nas they [do not mangle during minification](https://github.com/pastelsky/package-build-stats/blob/v6.1.1/src/getDependencySizeTree.js#L139).\n\n## License\n\n[MIT](./LICENSE)\n\n## Contributing\n\nPlease see our [contributions guide](./CONTRIBUTING.md).\n\n## Maintenance Status\n\n**Active:** Nearform is actively working on this project, and we expect to continue work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.\n\n[actions_img]: https://github.com/FormidableLabs/react-fast-compare/actions/workflows/ci.yml/badge.svg\n[actions_site]: https://github.com/FormidableLabs/react-fast-compare/actions/workflows/ci.yml\n[npm_img]: https://img.shields.io/npm/v/react-fast-compare.svg\n[npm_site]: https://www.npmjs.com/package/react-fast-compare\n[downloads_img]: https://img.shields.io/npm/dm/react-fast-compare.svg\n[maintenance_img]: https://img.shields.io/badge/maintenance-active-green.svg\n","publish_time":1795205762391,"_cnpm_publish_time":1795205762391,"dist-tags":{"beta":"3.0.0-beta.1","latest":"3.2.4","next":"3.2.3-canary-20261105232110"}}