I have a List of objects. All of the objects contain a NAME property. There are several objects that have the same NAME property.
const arr = [
{name: "x", place: "a", age: "13" },
{name: "x", place: "b", age: "14" },
{name: "y", place: "c", age: "15" },
{name: "d", place: "d", age: "16" }
]
How can I trim the List (or make a new List) where there is only one object per NAME property? Any other duplicates should be removed of the List
I should get a result like this
const arr = [
{name: "x", place: "a", age: "13" },
{name: "y", place: "c", age: "15" },
{name: "d", place: "d", age: "16" }
]
or
const arr = [
{name: "x", place: "b", age: "14" },
{name: "y", place: "c", age: "15" },
{name: "d", place: "d", age: "16" }
]
can i do it with Lodash?