gitea push
This commit is contained in:
+10
-7
@@ -28,18 +28,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
||||
merge.identify(key.value))) &&
|
||||
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
||||
function addMergeToJSMap(ctx, map, value) {
|
||||
value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||
if (identity.isSeq(value))
|
||||
for (const it of value.items)
|
||||
const source = resolveAliasValue(ctx, value);
|
||||
if (identity.isSeq(source))
|
||||
for (const it of source.items)
|
||||
mergeValue(ctx, map, it);
|
||||
else if (Array.isArray(value))
|
||||
for (const it of value)
|
||||
else if (Array.isArray(source))
|
||||
for (const it of source)
|
||||
mergeValue(ctx, map, it);
|
||||
else
|
||||
mergeValue(ctx, map, value);
|
||||
mergeValue(ctx, map, source);
|
||||
}
|
||||
function mergeValue(ctx, map, value) {
|
||||
const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
|
||||
const source = resolveAliasValue(ctx, value);
|
||||
if (!identity.isMap(source))
|
||||
throw new Error('Merge sources must be maps or map aliases');
|
||||
const srcMap = source.toJSON(null, ctx, Map);
|
||||
@@ -62,6 +62,9 @@ function mergeValue(ctx, map, value) {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
function resolveAliasValue(ctx, value) {
|
||||
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
||||
}
|
||||
|
||||
exports.addMergeToJSMap = addMergeToJSMap;
|
||||
exports.isMergeKey = isMergeKey;
|
||||
|
||||
Reference in New Issue
Block a user