rtfeldman/seamless-immutable

Compare equality of two immutable items

Open

#186 opened on Dec 15, 2016

View on GitHub
 (1 comment) (27 reactions) (0 assignees)JavaScript (5,367 stars) (221 forks)batch import
enhancementhelp wanted

Description

This is essentially https://github.com/rtfeldman/seamless-immutable/issues/1, but am opening another issue for visibility as the prior is closed and there's no attention on it.

I'd like to have a method like Immutable.equals(a, b, deepWalk?) to compare if two objects are equal.

This is useful for perf optimization in React if I have a deeply nested object coming down (ignore best practices for props/how loaded an object should be going through to a component for the sake of argument here), where I can compare the new object to the current one in shouldComponentUpdate().

In some of my old components, I'm using immutable.js against the objects, and using the .equals() to compare them as part of a decision if the component should be updating or not.

Contributor guide