dequal
dequal copied to clipboard
A tiny (304B to 489B) utility to check for deep equality
This is definitely an edge-case, but when comparing objects like `Array` across iframe boundaries, `instanceof` will not work. See MDN's example of this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#instanceof_vs_isArray
See https://stackblitz.com/edit/js-gxcyih?file=index.js I think it's because of the way we fall into the "plain" object comparison in https://github.com/lukeed/dequal/blob/master/src/index.js#L73-L80 ```javascript const x = new URLSearchParams(); x.append("foo", "bar"); for (i in x)...
Reverse iteration over TypedArrays was starting at `foo.byteLength - 1`, not `foo.length - 1`. For TypedArrays with .BYTES_PER_ELEMENT greater than 1, that was resulting in up to 7*`foo.length` needless pairs...
If both arguments have cycles, like if you're trying to compare doubly-linked lists, dequal goes into an infinite loop. repro: ```ts const a: any = {}, b: any = {};...
Hi, thanks for the lib 👏 Why don't you compare functions with `function.toString()`? I have a case where it could help me...
@lukeed Now no one has to scroll. 
Repo: https://github.com/planttheidea/fast-equals Draft: https://github.com/rtritto/dequal/tree/benchs Discussion: https://github.com/pmndrs/jotai/discussions/2649#discussioncomment-10847636
https://e18e.dev/ is promoting `dequal` as an alternative to `deep-equal`, so running tests on LTS versions could help people trust the switch. -> https://github.com/es-tooling/module-replacements/blob/main/docs/modules/deep-equal.md
This pull request resolves [Issue #9](https://github.com/lukeed/dequal/issues/9), which identifies a problem with dequal failing to handle comparisons of objects created in different realms (e.g., arrays from iframes or VM contexts). **Changes**...
https://github.com/lukeed/klona/releases/tag/v2.0.0