Mari's guided journal software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

13 lines
416 B

export function merge<Update extends {readonly [key: string]: any}, Data extends Update>(update: Update, base: Data): Data {
const data = {
...update,
...base,
}
// Purge keys that were intentionally removed...
Object.keys(update).forEach((key: keyof typeof update) => {
if (typeof update[key] === "undefined") {
delete data[key]
}
})
return data
}