1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-01-18 14:02:04 +00:00
overleaf/libraries/settings/merge.js
2021-07-06 13:52:59 +01:00

12 lines
322 B
JavaScript

function merge(settings, defaults) {
for (const [key, value] of Object.entries(settings)) {
if ((typeof(value) === "object") && !(value instanceof Array)) {
defaults[key] = merge(value, defaults[key] || {});
} else {
defaults[key] = value;
}
}
return defaults;
}
module.exports = { merge };