rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

Set method will check if value is same? #233

Open jintoppy opened 7 years ago

jintoppy commented 7 years ago

This is what it says in Immutable.js docs.

As a performance optimization Immutable.js attempts to return the existing collection when an operation would result in an identical collection, allowing for using === reference equality to determine if something definitely has not changed. This can be extremely useful when used within a memoization function which would prefer to re-run the function if a deeper equality check could potentially be more costly. The === equality check is also used internally by Immutable.is and .equals() as a performance optimization.

That means, even if we set a value, it wont create a new reference, if the new value given is same as the existing value.

Is it the same case with seamless-immutable?

Also, what is the method to do an equality check? Like, equals in ImmutableJS

Thanks in advance.

PS: I am asking a question here. You could ask why I didn't ask in StackOverflow. It is because, I couldn't find these items mentioned anywhere in the docs. I feel, these are important enough to be part of documentation. Thats why adding as a github issue.