September 2017
Intermediate to advanced
216 pages
6h 8m
English
You can use map() to transform a list of maps into one that only has the keys that you need. To do this, you can implement a couple of utility functions that compose iteratees for you, as follows:
const pick = (...props) => map => map .filter((v, k) => props.includes(k));const omit = (...props) => map => map .filterNot((v, k) => props.includes(k));
The pick() function returns an iteratee that will return a map that only includes the keys that are passed to pick(). The omit() function is the inverse of pick()—it will include everything except the keys passed to omit(). Let's see how they work here:
const myList = List.of( Map.of('first', 'joe', 'last', 'brown', 'age', 45), Map.of('first', 'john', 'last', 'smith', 'age', 32), ...Read now
Unlock full access