lib/lmd_common.js
function (configA, configB, flagsNames, inheritableFields, isMasterConfig, context) {
    if (isMasterConfig) {
        // Apply master fields
        inheritableFields.forEach(function (fieldName) {
            if (typeof configB[fieldName] !== "undefined") {
                configA[fieldName] = configB[fieldName];
                if (FILED_ALIASES.hasOwnProperty(fieldName)) {
                    configA[FILED_ALIASES[fieldName]] = configB[fieldName];
                }
            }
        });
    }

    // Save errors
    configA.errors = configA.errors || [];
    configB.errors = configB.errors || [];
    configA.errors = configA.errors.concat(configB.errors);

    // Apply Flags
    mergeFlags(configA, configB, flagsNames, isMasterConfig);

    // Apply Modules
    configA.modules = configA.modules || {};
    configB.modules = configB.modules || {};
    for (var moduleName in configB.modules) {
        // Warn if module exists an its not a master config
        if (!isMasterConfig && configA.modules[moduleName]) {
            if (!isModulesEqual(configA.modules[moduleName], configB.modules[moduleName])) {
                configA.errors.push('Name conflict! Module **"' + moduleName + '"** will be overwritten by ' + context);
            }
        }
        configA.modules[moduleName] = configB.modules[moduleName];
    }

    // Apply styles
    configA.styles = configA.styles || [];
    configB.styles = configB.styles || [];
    configA.styles = configA.styles.concat(configB.styles);

    // Apply Bundles
    configA.bundles = configA.bundles || {};
    configB.bundles = configB.bundles || {};
    for (var bundleName in configB.bundles) {
        if (configB.bundles[bundleName]) {
            if (!configA.bundles[bundleName]) {
                configA.bundles[bundleName] = {};
            }
            // Bundle is not exists
            if (configB.bundles[bundleName] instanceof Error) {
                configA.bundles[bundleName] = configB.bundles[bundleName];
            } else {
                mergeConfigs(configA.bundles[bundleName], configB.bundles[bundleName], flagsNames, MASTER_FIELDS, true, context);
            }
        }
    }

    // Apply User Plugins
    configA.plugins = configA.plugins || {};
    configB.plugins = configB.plugins || {};
    for (var pluginName in configB.plugins) {
        // Warn if module exists an its not a master
        if (!isMasterConfig && configA.plugins[pluginName]) {
            configA.errors.push('Name conflict! User plugin **"' + pluginName + '"** will be overwritten by ' + context);
        }
        configA.plugins[pluginName] = configB.plugins[pluginName];
    }

    return configA; // not rly need...
}
function (configA, configB, flagsNames, inheritableFields, isMasterConfig, context) {
    if (isMasterConfig) {
        // Apply master fields
        inheritableFields.forEach(function (fieldName) {
            if (typeof configB[fieldName] !== "undefined") {
                configA[fieldName] = configB[fieldName];
                if (FILED_ALIASES.hasOwnProperty(fieldName)) {
                    configA[FILED_ALIASES[fieldName]] = configB[fieldName];
                }
            }
        });
    }

    // Save errors
    configA.errors = configA.errors || [];
    configB.errors = configB.errors || [];
    configA.errors = configA.errors.concat(configB.errors);

    // Apply Flags
    mergeFlags(configA, configB, flagsNames, isMasterConfig);

    // Apply Modules
    configA.modules = configA.modules || {};
    configB.modules = configB.modules || {};
    for (var moduleName in configB.modules) {
        // Warn if module exists an its not a master config
        if (!isMasterConfig && configA.modules[moduleName]) {
            if (!isModulesEqual(configA.modules[moduleName], configB.modules[moduleName])) {
                configA.errors.push('Name conflict! Module **"' + moduleName + '"** will be overwritten by ' + context);
            }
        }
        configA.modules[moduleName] = configB.modules[moduleName];
    }

    // Apply styles
    configA.styles = configA.styles || [];
    configB.styles = configB.styles || [];
    configA.styles = configA.styles.concat(configB.styles);

    // Apply Bundles
    configA.bundles = configA.bundles || {};
    configB.bundles = configB.bundles || {};
    for (var bundleName in configB.bundles) {
        if (configB.bundles[bundleName]) {
            if (!configA.bundles[bundleName]) {
                configA.bundles[bundleName] = {};
            }
            // Bundle is not exists
            if (configB.bundles[bundleName] instanceof Error) {
                configA.bundles[bundleName] = configB.bundles[bundleName];
            } else {
                mergeConfigs(configA.bundles[bundleName], configB.bundles[bundleName], flagsNames, MASTER_FIELDS, true, context);
            }
        }
    }

    // Apply User Plugins
    configA.plugins = configA.plugins || {};
    configB.plugins = configB.plugins || {};
    for (var pluginName in configB.plugins) {
        // Warn if module exists an its not a master
        if (!isMasterConfig && configA.plugins[pluginName]) {
            configA.errors.push('Name conflict! User plugin **"' + pluginName + '"** will be overwritten by ' + context);
        }
        configA.plugins[pluginName] = configB.plugins[pluginName];
    }

    return configA; // not rly need...
}
Merges configs

@param {Object}   configA
@param {Object}   configB
@param {String[]} flagsNames
@param {Array}    inheritableFields
@param {Boolean}  isMasterConfig some parameters from configA will be overwritten using configB
@param {String}   context        configB description

@return {*}