import { assert } from "./test.mjs"; function shallow_mutable_copy (source, target) { for (const [key, value] of Object.entries(source)) { target[key] = value; } } export function underride (object, template) { const result = {}; shallow_mutable_copy(template, result); shallow_mutable_copy(object, result); return result; } assert("underriding works.", _ => { const object = underride({ gay: true, trans: true, }, { trans: false, invisible: false, }); return object.gay && object.trans && (object.invisible === false); });