【发布时间】:2020-01-22 17:18:10
【问题描述】:
假设我的对象看起来像这样
{
"success": true,
"result": 1,
"id": "123",
"group": [
{
"id": "333",
"label": "group 1",
"students": [
{
"id": "s123",
"name": "ying"
},
{
"id": "s456",
"name": "yang"
}
]
},
{
"id": "888",
"label": "group 2",
"students": [
{
"id": "j123",
"name": "yinga"
},
{
"id": "j456",
"name": "yanga"
}
]
},
]
}
我需要删除所有带有键“id”的属性。. 表示根对象内的ids,组和学生需要完全删除。
如何在 Node 或 lodash 中做到这一点?
【问题讨论】:
-
你只想达到
{succsess : value, result: value }? -
这能回答你的问题吗? Lodash remove items recursively