September 2017
Intermediate to advanced
216 pages
6h 8m
English
What if you have large collections in your application? The ability to execute lazily is key to Immutable.js being able to scale. Using sets to lazily remove duplicates from a collection isn't so simple. Let's give it a shot:
const myList = List.of( Map.of('one', 1, 'two', 2), Map.of('three', 3, 'four', 4), Map.of('one', 1, 'two', 2), Map.of('five', 5, 'six', 6), Map.of('one', 1, 'two', 2));myList .toSetSeq() .map(v => v.toJS()) .forEach(v => console.log('toSetSeq()', v)); // -> toSetSeq() { one: 1, two: 2 } // -> toSetSeq() { three: 3, four: 4 } // -> toSetSeq() { one: 1, two: 2 } // -> toSetSeq() { five: 5, six: 6 } // -> toSetSeq() { one: 1, two: 2 }
This didn't work as expected. We used toSetSeq() to convert myList ...
Read now
Unlock full access