Fix Object.assign

This commit is contained in:
Rhys Arkins 2017-01-13 15:53:02 +01:00
parent 7dc2f9b36c
commit 4a65854f2c
4 changed files with 5 additions and 5 deletions

View file

@ -36,7 +36,7 @@ module.exports = function init() {
}, },
]; ];
} }
const config = Object.assign(defaultConfig, customConfig, cliConfig); const config = Object.assign({}, defaultConfig, customConfig, cliConfig);
// Set log level // Set log level
logger.level = config.logLevel; logger.level = config.logLevel;

View file

@ -42,7 +42,7 @@ function findUpgrades(dependencies) {
if (upgrades.length > 0) { if (upgrades.length > 0) {
logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`); logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`);
upgrades.forEach((upgrade) => { upgrades.forEach((upgrade) => {
allDependencyUpgrades.push(Object.assign(dep, upgrade)); allDependencyUpgrades.push(Object.assign({}, dep, upgrade));
}); });
} else { } else {
logger.verbose(`${dep.depName}: No upgrades required`); logger.verbose(`${dep.depName}: No upgrades required`);

View file

@ -23,7 +23,7 @@ p.then(() => { // eslint-disable-line promise/always-return
}); });
function getCascadedConfig(repo, packageFile) { function getCascadedConfig(repo, packageFile) {
const cascadedConfig = Object.assign(config, repo, packageFile); const cascadedConfig = Object.assign({}, config, repo, packageFile);
delete cascadedConfig.repositories; delete cascadedConfig.repositories;
config.logger.verbose(`Cascaded config=${JSON.stringify(cascadedConfig)}`); config.logger.verbose(`Cascaded config=${JSON.stringify(cascadedConfig)}`);
return cascadedConfig; return cascadedConfig;

View file

@ -11,8 +11,8 @@ module.exports = processPackageFile;
// This function manages the queue per-package file // This function manages the queue per-package file
function processPackageFile(repoName, packageFile, setConfig) { function processPackageFile(repoName, packageFile, setConfig) {
// Initialize globals // Initialize globals
config = setConfig; logger = setConfig.logger;
logger = config.logger; config = Object.assign({}, setConfig);
// Initialize helpers // Initialize helpers
github.init(config.token, logger); github.init(config.token, logger);