179
Using JavaScript what's the quickest way to recursively remove properties and values from an object?
rated 0 times
[
186]
[
7]
/ answers: 1 / hits: 23236
/ 9 Years ago, thu, july 30, 2015, 12:00:00
I need to find the fastest way to remove all $meta
properties and their values from an object, for example:
{
part_one: {
name: My Name,
something: 123,
$meta: {
test: test123
}
},
part_two: [
{
name: name,
dob: dob,
$meta: {
something: else,
and: more
}
},
{
name: name,
dob: dob
}
],
$meta: {
one: 1,
two: 2
}
}
Should become the following given that the $meta
property could be at any point in the object so some form of recursion will probably be needed.
{
part_one: {
name: My Name,
something: 123
},
part_two: [
{
name: name,
dob: dob
},
{
name: name,
dob: dob
}
]
}
Any help or advice would be greatly appreciated!
Thank you!
More From » object