You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This question was asked before at #91 but the only proposed answer was to modify the library.
I believe making this library optionally support immutable reference equality would be easy if the prefilter function also passed the lhs and rhs values to the prefilter. This would allow us to opt-in to reference equality using
This allows skipping reference equality without having to modify the library's core function. The existing prefilter option is taken advantage of, and also is expanded on to allow other types of prefilters relying on the value of the thing being filtered (for example, possibly against objects signifying equality using ID properties).
The text was updated successfully, but these errors were encountered:
RoboPhred
changed the title
Support reference equality immutability using prefilter
Support reference equality immutability
Feb 18, 2021
It has occurred to me after writing this that a reference equality check should in fact be baked into the library, and there is no point making it optional. If two objects are the same reference, then by definition they have the same content, and there is never any need to recurse into them.
Not a perfect implementation but you have the option of passing prefilter as an object which accepts a function by key normalize which does receive lhs and rhs and you can control checks by that.
This question was asked before at #91 but the only proposed answer was to modify the library.
I believe making this library optionally support immutable reference equality would be easy if the
prefilter
function also passed thelhs
andrhs
values to the prefilter. This would allow us to opt-in to reference equality usingThis allows skipping reference equality without having to modify the library's core function. The existing prefilter option is taken advantage of, and also is expanded on to allow other types of prefilters relying on the value of the thing being filtered (for example, possibly against objects signifying equality using ID properties).
The text was updated successfully, but these errors were encountered: