我有这两个数组对象Ramda.js结合共享相同的属性ID
todos: [
{
id: 1,
name: 'customerReport',
label: 'Report send to customer'
},
{
id: 2,
name: 'handover',
label: 'Handover (in CRM)'
},
]
和对象的两个数组:
todosMoreDetails: [
{
id: 1,
checked: false,
link: {
type: 'url',
content: 'http://something.com'
},
notes: []
},
{
id: 2,
checked: false,
link: {
type: 'url',
content: 'http://something.com'
},
notes: []
}
]
使物体的最终阵列将是一个两者的组合的基础上,对象ID,象下面这样:
FinalTodos: [
{
id: 1,
checked: false,
link: {
type: 'url',
content: 'http://something.com'
},
notes: [],
name: 'customerReport',
label: 'Report send to customer'
},
{
id: 2,
checked: false,
link: {
type: 'url',
content: 'http://something.com'
},
notes: [],
name: 'handover',
label: 'Handover (in CRM)'
}
]
我试图与merge
mergeAll
和mergeWithKey
但我可能缺少的东西
它的工作原理!但我不知道为什么。你可以简要解释一下吗?这将是伟大的 – Anonymous
增加了一些我的建议的细节 –