我有以下格式的数据,基本上是一个对象数组,我尝试了几种方法,我怎样才能更有效地做到这一点?
const overdue = [
{
"user.employeeId": "10001440",
"objectives": [
"Understand the financial indexes."
]
},
{
"user.employeeId": "10000303",
"objectives": [
"Document preparation & writing skills"
]
},
{
"user.employeeId": "10002168",
"objectives": [
"Chia ratio setting for Fuze Tea products L11"
]
},
{
"user.employeeId": "10002168",
"objectives": [
"Brix parameter differences between Processing and Production of Fuze Tea Lemon-Lemongrass standardization"
]
},
{
"user.employeeId": "10002168",
"objectives": [
"Paramix Line 9 setting parameter standardization"
]
},
]
我如何使用 lodash 通过 JavaScript 将其转换为以下内容?
[
{
"user.employeeId": "10001440",
"objectives": [
"Understand the financial indexs."
]
},
{
"user.employeeId": "10000303",
"objectives": [
"Document preparation & writing skills"
]
},
{
"user.employeeId": "10002168",
"objectives": [
"Brix parameter differences between Processing and Production of Fuze Tea Lemon-Lemongrass standardization",
"Paramix Line 9 setting parameter standardization",
"Chia ratio setting for Fuze Tea products L11"
]
}
]
我试过 Array.map!和正常的逻辑,我们如何使用 lodash reduce 或 arr.reduce 更有效地做到这一点?
千万里不及你
慕盖茨4494581
largeQ
慕姐8265434
相关分类