【发布时间】:2016-05-09 12:20:56
【问题描述】:
我想从这个 obj 中合并对象:
objs = {
one: { description: "value", amount: 5, value: { description: "value desc", identifier: "some text"} },
two: { description: "value", amount: 5, value: { description: "value desc", identifier: "some text"} }
}
进入这个 obj:
objs = {
one: { original_description: "value", amount: 5, description: "value desc", identifier: "some text" },
two: { original_description: "value", amount: 5, description: "value desc", identifier: "some text" }
}
UPD: @ryeballar 的解决方案正在运行,但我发现了问题,“子对象”包含与父对象相同的键名。
【问题讨论】:
标签: javascript object lodash