SOURCE

const list1 = [{ id: 1, array: [1, 2, 3] }, { id: 1, array: [4, 5, 6] }]

const mergedList = _.map
    (_.groupBy(list1, 'id'),
    (value, key) =>
        ({
            id: key, array:
                value.reduce((sum, v) => ([...sum, v.array]), [])
        }))

        const mergedList2 = _.map
    (_.groupBy(list1, 'id'),
    (value, key) =>
        ({
            id: key, array:
                value.reduce((sum, v) => ([...sum, v.array]), [])
        }))

console.log(mergedList)

console.log(mergedList2)
console 命令行工具 X clear

                    
>
console