angular-l10n
Version:
An Angular library to translate messages, dates and numbers
37 lines • 1.01 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @param {?} item
* @return {?}
*/
function isObject(item) {
return (typeof item === "object" && !Array.isArray(item));
}
/**
* @param {?} target
* @param {?} source
* @return {?}
*/
export function mergeDeep(target, source) {
/** @type {?} */
const output = Object.assign({}, target);
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach((key) => {
if (isObject(source[key])) {
if (!(key in target)) {
Object.assign(output, { [key]: source[key] });
}
else {
output[key] = mergeDeep(target[key], source[key]);
}
}
else {
Object.assign(output, { [key]: source[key] });
}
});
}
return output;
}
//# sourceMappingURL=merge-deep.js.map