rtfeldman/seamless-immutable

Compare equality of two immutable items

Open

#186 aperta il 15 dic 2016

Vedi su GitHub
 (1 commento) (27 reazioni) (0 assegnatari)JavaScript (221 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (5367 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor