Skip to content

Commit

Permalink
use switch statement to replace if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
richardcrng committed Sep 1, 2019
1 parent 79ef75b commit 7e4922d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/actions/proxy/ActionsProxy.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ class ActionsProxy {

return new Proxy(this, {
get: (obj, prop: string | number) => {
if (prop === '_path') {
return path
} else if (prop === 'create') {
return actionsAPI(stateShape, actionsDict, path)
} else {
return new ActionsProxy(stateShape, actionsDict, [...path, prop])
switch (prop) {
case '_path': return path
case 'create': return actionsAPI(stateShape, actionsDict, path)
default: return new ActionsProxy(stateShape, actionsDict, [...path, prop])
}
}
})
Expand Down

0 comments on commit 7e4922d

Please sign in to comment.