Quellcode durchsuchen

refactor: simplify getNestedState (#1651)

ZuoChenxue vor 5 Jahren
Ursprung
Commit
d3979fddd5
1 geänderte Dateien mit 1 neuen und 3 gelöschten Zeilen
  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) {