Open PhoenixMenia opened 2 years ago
I believe this is by design. You'd need to use define a custommerge function if you want to change this behavior.
This is also by design in my library (deepmerge-ts) but this behavior can be overridden. Here's the example of doing that: https://github.com/RebeccaStevens/deepmerge-ts/discussions/25
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
the below code will get a return value showed in the picture below. I dont want an invalid value to override the value of the target.
var deepmerge = require("deepmerge")
const combineMerge = (target, source, options) => { if (typeof source[0] === 'string') { return source; }
}
const options = { arrayMerge: combineMerge, customMerge: (key, options) => { return undefined } }
const alex = { name: { first: 'Alex', last: 'Alexson' }, pets: ['Cat', 'Parrot'] }
const tony = { name: { first: undefined, last: 'Tonison' }, pets: ['Dog'] }
const result = deepmerge(alex, tony, options)