Skip to content

Support reference equality immutability #169

Open
@RoboPhred

Description

@RoboPhred

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

function prefilterImmutable(path, key, lhs, rhs) {
  return lhs === rhs
}
diff(foo, bar, prefilterImmutable)

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions