Skip to content

Commit

Permalink
fix some default and loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentyn-Bilyk committed Aug 2, 2023
1 parent 16ef78f commit 222edb2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/transformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@ function transformState(state, actions) {

case 'removeProperties':
for (const key of action.keysToRemove) {
if (state[key]) {
delete state[key];
}
delete state[key];
}
break;

case 'clear':
for (const element in state) {
delete state[element];
for (const property in state) {
delete state[property];
}
break;

default:
return state;
throw new Error('sorry)))');
}
}

Expand Down

0 comments on commit 222edb2

Please sign in to comment.