Basically I want to know how to clean an array of objects in JavaScript.
I have seen some samples that show how to do it depending on the value of one element and I need it to be generic. It means that it doesn't depend on the child's names.
Example of the way i don't want
What I need is a function that can work independently of the object structure.
For example, it can work with this:
object = [
{value: 'value', configuration: 'configuration'},
{value: 'value2', configuration: 'configuration2'},
{value: 'value', configuration: 'configuration'},
]
//returning:
object = {
{value: 'value', configuration: 'configuration'},
{value: 'value2', configuration: 'configuration2'}
}
And it can also work with:
object = [
{name: 'name', property: 'property'},
{name: 'name2', property: 'property2'},
{name: 'name', property: 'property'},
]
//returning:
object = [
{name: 'name', property: 'property'},
{name: 'name2', property: 'property2'}
]