September 2017
Intermediate to advanced
216 pages
6h 8m
English
Immutable.js exports an is() function, which is used to compare two values. It can compare primitive JavaScript types using the same semantics as Object.is(), and it can do deep comparisons between two Immutable.js collections. When you pass two collections to is(), it will actually call the equals() method of the first collection. This means that you can be more direct if you know that you're comparing two collection types by calling equals(). If you don't know what you're comparing, is() is the better choice.
Let's start by comparing some lists:
const myList = List.of(1, 2);console.log('myList', myList.toJS());// -> myList [ 1, 2 ]console.log('is([1, 2])', is(myList, List.of(1, 2)));// -> ...Read now
Unlock full access