mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
17 lines
340 B
JavaScript
17 lines
340 B
JavaScript
module.exports = function merge(def, given) {
|
|
if (!given) {
|
|
return def;
|
|
}
|
|
|
|
given = given || {};
|
|
|
|
for (const key in def) {
|
|
if (!{}.hasOwnProperty.call(given, key)) {
|
|
given[key] = def[key];
|
|
} else if (given[key] === Object(given[key])) {
|
|
given[key] = merge(def[key], given[key]);
|
|
}
|
|
}
|
|
|
|
return given;
|
|
};
|