September 2017
Intermediate to advanced
216 pages
6h 8m
English
Plucking a value from a map is another way of saying look up a value based on a key. It's common to say "pluck" when mapping a collection of maps to a particular key. Imagine plucking blades of grass from a lawn that fit a particular profile. Let's look at an example:
const myList = List.of( Map.of('first', 1, 'second', 2), Map.of('first', 3, 'second', 4), Map.of('first', 5, 'second', 6));const myMappedList = myList .map(v => v.get('second'));console.log('myList', myList.toJS());// -> myList [ { first: 1, second: 2 },// -> { first: 3, second: 4 },// -> { first: 5, second: 6 } ]console.log('myMappedList', myMappedList.toJS());// -> myMappedList [ 2, 4, 6 ]
The myMappedList list now has the values of the second key. The iteratee ...
Read now
Unlock full access