Przeglądaj źródła

tweak code to keep coding style consistency

Alan Wei 7 lat temu
rodzic
commit
fad3f4ac7c
1 zmienionych plików z 13 dodań i 12 usunięć
  1. 13 12
      src/components/SiderMenu/SiderMenu.js

+ 13 - 12
src/components/SiderMenu/SiderMenu.js

@@ -28,13 +28,14 @@ const getIcon = icon => {
  * @param  menu
  */
 export const getFlatMenuKeys = menu =>
-  menu.reduce((keys, item) => {
-    keys.push(item.path);
-    if (item.children) {
-      return keys.concat(getFlatMenuKeys(item.children));
-    }
-    return keys;
-  }, []);
+  menu
+    .reduce((keys, item) => {
+      keys.push(item.path);
+      if (item.children) {
+        return keys.concat(getFlatMenuKeys(item.children));
+      }
+      return keys;
+    }, []);
 
 /**
  * Find all matched menu keys based on paths
@@ -42,11 +43,11 @@ export const getFlatMenuKeys = menu =>
  * @param  paths: [/abc, /abc/11, /abc/11/info]
  */
 export const getMeunMatchKeys = (flatMenuKeys, paths) =>
-  paths.reduce(
-    (matchKeys, path) =>
-      matchKeys.concat(flatMenuKeys.filter(item => pathToRegexp(item).test(path))),
-    []
-  );
+  paths
+    .reduce((matchKeys, path) => (
+      matchKeys.concat(
+        flatMenuKeys.filter(item => pathToRegexp(item).test(path))
+    )), []);
 
 export default class SiderMenu extends PureComponent {
   constructor(props) {