deepmerge 对象合并


1、简介

深度合并两个或多个对象的可枚举属性。

https://www.npmjs.com/package/deepmerge

2、示例

const x = { foo: { bar: 3 }, array: [{ does: 'work', too: [ 1, 2, 3 ] }] } const y = { foo: { baz: 4 }, quux: 5, array: [{ does: 'work', too: [ 4, 5, 6 ] }, { really: 'yes' }] } const output = { foo: { bar: 3, baz: 4 }, array: [{ does: 'work', too: [ 1, 2, 3 ] }, { does: 'work', too: [ 4, 5, 6 ] }, { really: 'yes' }], quux: 5 } merge(x, y) // => output

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM