"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeDeep = exports.getKeys = exports.isObject = void 0;
const isObject = (item) => item && typeof item === 'object' && !Array.isArray(item);
exports.isObject = isObject;
const getKeys = (item) => ((0, exports.isObject)(item) ? Object.keys(item) : []);
exports.getKeys = getKeys;
const mergeDeep = (target, source) => {
    if ((0, exports.isObject)(target) || (0, exports.isObject)(source)) {
        const newObject = {};
        const allKeys = (0, exports.getKeys)(target).concat((0, exports.getKeys)(source));
        for (const key of allKeys) {
            if ((0, exports.isObject)(source === null || source === void 0 ? void 0 : source[key]) || (0, exports.isObject)(target === null || target === void 0 ? void 0 : target[key])) {
                newObject[key] = (0, exports.mergeDeep)(target === null || target === void 0 ? void 0 : target[key], source === null || source === void 0 ? void 0 : source[key]);
            }
            else
                Object.assign(newObject, { [key]: typeof (source === null || source === void 0 ? void 0 : source[key]) === 'string' ? source === null || source === void 0 ? void 0 : source[key] : (source === null || source === void 0 ? void 0 : source[key]) || (target === null || target === void 0 ? void 0 : target[key]) });
        }
        return newObject;
    }
    else
        return target;
};
exports.mergeDeep = mergeDeep;
//# sourceMappingURL=ObjectHelper.js.map