Skip to content

Commit

Permalink
Change switch statement
Browse files Browse the repository at this point in the history
  • Loading branch information
natalia-matash committed Dec 28, 2023
1 parent aa77cac commit 38e2f0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/transformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ function transformState(state, actions) {
for (const action of actions) {
const { type, extraData, keysToRemove } = action;

switch (true) {
case type === 'clear': {
switch (type) {
case 'clear': {
for (const s in state) {
delete state[s];
}
break;
}

case type === 'addProperties': {
case 'addProperties': {
Object.assign(state, extraData);
break;
}

case type === 'removeProperties': {
case 'removeProperties': {
for (const key of keysToRemove) {
delete state[key];
}
break;
}

default:
return 'Unexpected acrion';
return 'Unexpected action';
};
};

Expand Down

0 comments on commit 38e2f0b

Please sign in to comment.