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

18 lines
361 B
JavaScript

export function defaults(target, ...sources) {
for (let source of sources) {
for (let k in source) {
if (!target?.hasOwnProperty?.(k)) {
target[k] = source[k]
}
}
for (let k of Object.getOwnPropertySymbols(source)) {
if (!target?.hasOwnProperty?.(k)) {
target[k] = source[k]
}
}
}
return target
}