At underscore js, Can I get multiple columns with pluck method after input where method as linq select projection

后端 未结 7 1160
小蘑菇
小蘑菇 2021-01-30 12:59
var people = [
    {firstName : \"Thein\", city : \"ny\", qty : 5},
    {firstName : \"Michael\", city : \"ny\", qty : 3},
    {firstName : \"Bloom\", city : \"nj\", qty         


        
相关标签:
7条回答
  • 2021-01-30 14:03

    Yep, I wish pluck had an option of passing an array, but in the meantime, you could do:

    const pluckFields = (arr, fields) => _.map(arr, item => _.pick(item, fields))
    
    0 讨论(0)
提交回复
热议问题