mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 15:02:51 +02:00
update schema merge customizer for better merging
This commit is contained in:
@@ -513,7 +513,8 @@ function resolveNodeRule(kind, type, obj) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A Lodash customizer for merging `kinds` and `types` arrays.
|
||||
* A Lodash customizer for merging schema definitions. Special cases `kinds`
|
||||
* and `types` arrays to be unioned, and ignores new `null` values.
|
||||
*
|
||||
* @param {Mixed} target
|
||||
* @param {Mixed} source
|
||||
@@ -523,6 +524,8 @@ function resolveNodeRule(kind, type, obj) {
|
||||
function customizer(target, source, key) {
|
||||
if (key == 'kinds' || key == 'types') {
|
||||
return target == null ? source : target.concat(source)
|
||||
} else {
|
||||
return source == null ? target : source
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user