diff --git a/src/transformState.js b/src/transformState.js index 178bcd228..c4804b511 100644 --- a/src/transformState.js +++ b/src/transformState.js @@ -6,20 +6,25 @@ */ function transformState(state, actions) { for (const action of actions) { - if (action.type === 'addProperties') { - Object.assign(state, action.extraData); - } + switch (action.type) { + case 'addProperties': + Object.assign(state, action.extraData); + break; - if (action.type === 'removeProperties') { - for (const key of action.keysToRemove) { - delete state[key]; - } - } + case 'removeProperties': + for (const key of action.keysToRemove) { + delete state[key]; + } + break; + + case 'clear': + for (const key in state) { + delete state[key]; + } + break; - if (action.type === 'clear') { - for (const key in state) { - delete state[key]; - } + default: + break; } } }