Update object assignment in toChangedFilesMatchConfig

This commit is contained in:
Josh Dales
2023-03-20 17:22:19 -04:00
parent 64ce5e9235
commit cc1e02580b

View File

@@ -61,16 +61,22 @@ export function toChangedFilesMatchConfig(
} 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`
Object.assign( changedFilesMatchConfig.changedFiles = changedFilesConfig.reduce(
changedFilesMatchConfig.changedFiles, (updatedMatchConfig, configValue) => {
...changedFilesConfig if (!configValue) {
); return updatedMatchConfig;
Object.keys(changedFilesMatchConfig.changedFiles).forEach(key => { }
const value = changedFilesMatchConfig.changedFiles[key];
changedFilesMatchConfig.changedFiles[key] = Array.isArray(value) Object.entries(configValue).forEach(([key, value]) => {
? value if (key === 'any' || key === 'all') {
: [value]; updatedMatchConfig[key] = Array.isArray(value) ? value : [value];
}
}); });
return updatedMatchConfig;
},
{}
);
} }
} }