@thangk/easythemer
Version:
Easily generate shades from a colour palette for use in your app
24 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const validators_1 = require("../validators");
function mergeObjects(object1, object2) {
if (!object2)
return;
const workingObject = structuredClone(object1);
console.log("workingObject", workingObject);
for (const [key, value] of Object.entries(workingObject)) {
const isValueAnObject = new validators_1.ValidateIsObject(value);
const valueKeysLen = Object.keys(workingObject[key]).length;
console.log(`${key}: ${value}`);
console.log("isValueAnObject", isValueAnObject);
console.log("valueKeysLen", valueKeysLen);
if (valueKeysLen && isValueAnObject.getResult) {
workingObject[key] = mergeObjects(workingObject[key], object2[key]);
continue;
}
workingObject[key] = object2[key] ?? workingObject[key];
}
return workingObject;
}
exports.default = mergeObjects;
//# sourceMappingURL=mergeObjects.js.map