delete bare value before numeral union

This commit is contained in:
Felix Roos 2022-12-09 11:00:28 +01:00
parent 5fbd1453b4
commit a45d63595f

View File

@ -12,6 +12,7 @@ export function unionWithObj(a, b, func) {
const numKeys = Object.keys(a).filter((k) => typeof a[k] === 'number');
const numerals = Object.fromEntries(numKeys.map((k) => [k, b.value]));
b = Object.assign(b, numerals);
delete b.value;
}
const common = Object.keys(a).filter((k) => Object.keys(b).includes(k));
return Object.assign({}, a, b, Object.fromEntries(common.map((k) => [k, func(a[k], b[k])])));