What happened to Lodash _.pluck?

前端 未结 5 2302
情深已故
情深已故 2020-11-29 19:21

I once used Lodash _.pluck...I loved pluck...

Realizing Lodash no longer supports pluck (as of Lodash 4.x), I\'m struggling to remember wha

5条回答
  •  情歌与酒
    2020-11-29 20:12

    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.

提交回复
热议问题