How can I get a unique array based on object property using underscore

前端 未结 8 1235
遇见更好的自我
遇见更好的自我 2020-12-29 18:30

I have an array of objects and I want to get a new array from it that is unique based only on a single property, is there a simple way to achieve this?

Eg.



        
8条回答
  •  执念已碎
    2020-12-29 18:35

    If you want to check all the properties then lodash 4 comes with _.uniqWith(sourceArray, _.isEqual)

提交回复
热议问题