浏览代码

refactor: simplify getNestedState (#1651)

ZuoChenxue 5 年之前
父节点
当前提交
d3979fddd5
共有 1 个文件被更改,包括 1 次插入3 次删除
  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) {