Skip to content

Commit

Permalink
Refactor code in change detection
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Jul 2, 2019
1 parent 068b9b9 commit 22966c7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/helpers/changeDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { getObjectPropertyValue, setObjectPropertyValue } from './objects';
/** Compare the workspace and the user configurations with the current setup of the icons. */
export const detectConfigChanges = () => {
const configs = Object.keys(getConfigProperties())
.map(c => c.split('.').slice(1).join('.'));
.map(c => c.split('.').slice(1).join('.'))
// remove configurable notification messages
.filter((c) => !/show(Welcome|Update|Reload)Message/g.test(c));

const changes = compareConfigs(configs);

Expand Down Expand Up @@ -38,9 +40,6 @@ export const detectConfigChanges = () => {
const compareConfigs = (configs: string[]): { updatedConfigs: IconJsonOptions, updatedJSONConfig: IconJsonOptions } => {
const json = getMaterialIconsJSON();
return configs.reduce((result, configName) => {
// no further actions (e.g. reload) required
if (/show(Welcome|Update|Reload)Message/g.test(configName)) return result;

try {
const themeConfig = getThemeConfig(configName);
const configValue = themeConfig.globalValue !== undefined ? themeConfig.globalValue : themeConfig.defaultValue;
Expand Down

0 comments on commit 22966c7

Please sign in to comment.