Condense assignment of further config options in toChangedFilesMatchConfig

This commit is contained in:
Josh Dales
2023-03-18 15:08:39 -04:00
parent 51b763cbf2
commit c08f5faa12

View File

@@ -175,14 +175,15 @@ function toChangedFilesMatchConfig(config: any): ChangedFilesMatchConfig {
} else { } else {
// If it is not an array of strings then it should be array of further config options // If it is not an array of strings then it should be array of further config options
// so assign them to our `changedFilesMatchConfig` // so assign them to our `changedFilesMatchConfig`
changedFilesConfig.forEach(config => { Object.assign(
// Make sure that the values that we assign to our match config are an array changedFilesMatchConfig.changedFiles,
Object.entries(config).forEach(([key, value]) => { ...changedFilesConfig
const element = { );
[key]: Array.isArray(value) ? value : [value] Object.keys(changedFilesMatchConfig.changedFiles).forEach(key => {
}; const value = changedFilesMatchConfig.changedFiles[key];
Object.assign(changedFilesMatchConfig.changedFiles, element); changedFilesMatchConfig.changedFiles[key] = Array.isArray(value)
}); ? value
: [value];
}); });
} }
} }