pluck
description
Returns a new flattened Collection
from an input collection of collections. The input collection is flattened by returning the value associated to the provided key of each inner collection. More simply put, pluck(key) = map(collection => collection[key])
.
example
Suppose we have a collection of characters
, each having a name
and an id
. Here, we're only interested in retrieving their names, so we flatten the input collection by returning the name
property of each character.
Last updated