Skip to content
Snippets Groups Projects
Commit 5f364cc2 authored by svornost's avatar svornost
Browse files

Replace `deepAssign` implementation with some lodash calls.

parent 1d3adafd
No related branches found
No related tags found
1 merge request!11135Replace `deepAssign` implementation with some lodash calls.
...@@ -365,25 +365,7 @@ function sortArrayByArray(sorted, unsorted, key) { ...@@ -365,25 +365,7 @@ function sortArrayByArray(sorted, unsorted, key) {
* @param {object} source * @param {object} source
*/ */
function deepAssign(target, source) { function deepAssign(target, source) {
function isObject(o) { _.assign(target, _.cloneDeep(source));
return (o !== undefined && o !== null && typeof o === 'object' && !Array.isArray(o));
}
if (isObject(target) && isObject(source)) {
for (const key in source) {
if (!source.hasOwnProperty(key)) { continue; }
if (isObject(source[key])) {
if (!target.hasOwnProperty(key) || !isObject(target[key])) {
target[key] = {};
}
deepAssign(target[key], source[key]);
} else {
Object.assign(target, {
[key]: source[key]
});
}
}
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment