Bläddra i källkod

refactor: simplify getNestedState (#1651)

ZuoChenxue 5 år sedan
förälder
incheckning
d3979fddd5
1 ändrade filer med 1 tillägg och 3 borttagningar
  1. 1 3
      src/store.js

+ 1 - 3
src/store.js

@@ -489,9 +489,7 @@ function enableStrictMode (store) {
 }
 
 function getNestedState (state, path) {
-  return path.length
-    ? path.reduce((state, key) => state[key], state)
-    : state
+  return path.reduce((state, key) => state[key], state)
 }
 
 function unifyObjectStyle (type, payload, options) {