Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happened to Lodash _.pluck?

People also ask

Is Lodash still maintained?

Lodash is one of those handful of libraries, that were created to solve a growing problem, that fortunately due to Microsoft's foresight, no longer exists.

What is Lodash UnderScore?

The lodash and UnderScore both are utility libraries from JavaScript which helps make it easier by providing utils which makes, working with arrays, numbers, objects, and strings much easier. They provide a group of tools used for common programming operations having a strong functional programming task.

Does Lodash exist?

The Lodash _. exists() method checks whether the given value is Exist or not and returns the corresponding boolean value. Both null and undefined are considered non-existy values. All other values are “Existy”.

Is Lodash popular?

Lodash is the most widely used utility library in the world as it provides a lot of methods that make coding easy and fast. According to the State of Javascript 2019 Survey results, lodash is at the top: In this article we will see, the different methods provided by lodash which makes coding easy.


Ah-ha! The Lodash Changelog says it all...

"Removed _.pluck in favor of _.map with iteratee shorthand"

var objects = [{ 'a': 1 }, { 'a': 2 }];

// in 3.10.1
_.pluck(objects, 'a'); // → [1, 2]
_.map(objects, 'a'); // → [1, 2]

// in 4.0.0
_.map(objects, 'a'); // → [1, 2]

There isn't a need for _.map or _.pluck since ES6 has taken off.

Here's an alternative using ES6 JavaScript:

clips.map(clip => clip.id)


Use _.map instead of _.pluck. In the latest version the _.pluck has been removed.


If you really want _.pluck support back, you can use a mixin:

const _ = require("lodash")

_.mixin({
    pluck: _.map
})

Because map now supports a string (the "iterator") as an argument instead of a function.