angular-l10n
Version:
An Angular library to translate messages, dates and numbers
38 lines • 1.07 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 {?} */
var output = Object.assign({}, target);
if (isObject(target) && isObject(source)) {
Object.keys(source).forEach(function (key) {
var _a, _b;
if (isObject(source[key])) {
if (!(key in target)) {
Object.assign(output, (_a = {}, _a[key] = source[key], _a));
}
else {
output[key] = mergeDeep(target[key], source[key]);
}
}
else {
Object.assign(output, (_b = {}, _b[key] = source[key], _b));
}
});
}
return output;
}
//# sourceMappingURL=merge-deep.js.map