Where is _.pluck() in lodash version 4?

Joe Hawkins picture Joe Hawkins · Feb 5, 2016 · Viewed 14.4k times · Source

What happened to pluck() in lodash version 4? What is a suitable replacement?

This syntax _.pluck(users, 'firstName'); is simple to me. Seems that _.map(users, function(user) { return user.firstName; } would do the trick but it's not nearly as neat.

Answer

Joe Hawkins picture Joe Hawkins · Feb 5, 2016

Looks like _.map(users, 'firstName'); should cover it.