Browse Source

refactor: simplify getNestedState (#1651)

ZuoChenxue 5 năm trước cách đây
mục cha
commit
d3979fddd5
1 tập tin đã thay đổi với 1 bổ sung3 xóa
  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) {