Merge pull request #913 from ONLYOFFICE/feature/deploy-add-tatar-lang

[deploy] extended function to merge configs
This commit is contained in:
maxkadushkin 2021-06-02 18:14:45 +03:00 committed by GitHub
commit 05b331ce03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,12 +145,22 @@ module.exports = function(grunt) {
if (_.isObject(target) && _.isObject(source)) { if (_.isObject(target) && _.isObject(source)) {
for (const key in source) { for (const key in source) {
if (_.isObject(source[key])) { let targetkey = key;
if (!target[key]) Object.assign(target, { [key]: {} });
else if (_.isArray(source[key])) target[key].push(...source[key]); if ( key[0] == '!' ) {
else _merge(target[key], source[key]); targetkey = key.substring(1);
if ( _.isArray(target[targetkey]) || _.isObject(target[targetkey]) )
target[targetkey] = undefined;
}
if (_.isObject(source[key]) && target[targetkey]) {
// if (!target[targetkey]) Object.assign(target, { [targetkey]: {} });
// else
if (_.isArray(source[key])) target[targetkey].push(...source[key]);
else _merge(target[targetkey], source[key]);
} else { } else {
Object.assign(target, { [key]: source[key] }); Object.assign(target, { [targetkey]: source[key] });
} }
} }
} }