Skip to content

Enhancement: Custom equals #1969

Open
Open
@joshding

Description

@joshding

Enhancement request:
custom equals
allow .equals to accept a callback, for example:

const x = Map({a: 1, b:2})
const y = Map({a:1, b:5})
x.equals(y, (x, y) => x.get("a") === y.get("a"));

Consider the above for more complex structures such as Immutable Records, it would be helpful to be able to compare only certain fields within a collection. Sometimes, API responses may not be in the exact same shape as data stored in client state, and populating the immutable structures with these data that just have minor discrepancies causes .equals() to return false, when really we are interested in only certain fields.

Any thoughts on this? ^

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