Skip to content

Commit

Permalink
fixed code
Browse files Browse the repository at this point in the history
  • Loading branch information
irahos committed Aug 2, 2023
1 parent b460f2e commit a715905
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 @@ -12,19 +12,17 @@ function transformState(state, actions) {
break;

case 'removeProperties':
action.keysToRemove.forEach((key) => {
if (state.hasOwnProperty(key)) {
delete state[key];
}
action.keysToRemove.forEach((keyToRemove) => {
delete state[keyToRemove];
});
break;

case 'clear':
Object.keys(state).forEach((key) => delete state[key]);
Object.keys(state).forEach((keyToDelete) => delete state[keyToDelete]);
break;

default:
throw Error('Invalid input.');
throw new Error('Invalid input.');
}
}

Expand Down

0 comments on commit a715905

Please sign in to comment.