overleaf/libraries/settings/merge.js
Jakob Ackermann 4de9c98d2f Merge pull request #6132 from overleaf/jpa-settings-linting
[settings] setup linting and fix all the violations

GitOrigin-RevId: 321ecf0e8749a0481d61ad720baffe06089dc5cf
2021-12-17 09:03:15 +00:00

12 lines
315 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 }