Skip to content

Commit

Permalink
Merge pull request #101 from richardcrng/refactor-ap-class
Browse files Browse the repository at this point in the history
use switch statement to replace if statement
  • Loading branch information
richardcrng committed Sep 1, 2019
2 parents 79ef75b + 7e4922d commit 1e80206
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 1e80206

Please sign in to comment.