Replies: 1 comment
-
Hi, I will skip this suggestion because:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Comparing two objects using
JSON.stringify
has 2 drawbacks:fast-deep-equal
and added equality functions usingJSON.stringify
and the stringify function fromfast-json-stable-stringify
to the benchmark. You can see some of the results below:{ required: true, min: true }
and{ min: true, required: true }
are considered different values. With a library likefast-deep-equal
orfast-equals
, they would be considered the same.Proposed solution
Instead of using the current equality function which uses
JSON.stringify
to check if two values are equal, use something likefast-deep-equal
to check.I can create a PR to do this. But, it will add a dependency. So, I wanted to reach out and see if this is something you would be interested in changing before going any further.
Alternatives considered
We could pipe the
errors$
observable likeerrors$.pipe(distinctUntilChanged(fastDeepEqual)
. But, that would still run them through theJSON.stringify
equality function, negating the speed benefit.Do you want to create a pull request?
Yes
Beta Was this translation helpful? Give feedback.
All reactions