1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00

update schema merge customizer for better merging

This commit is contained in:
Ian Storm Taylor 2017-11-01 00:14:30 -07:00
parent e6383cd40d
commit b8c60437db

View File

@ -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
}
}