Commit fad3f4ac authored by Alan Wei's avatar Alan Wei Committed by 陈帅

tweak code to keep coding style consistency

parent 4ddbfe6a
...@@ -28,13 +28,14 @@ const getIcon = icon => { ...@@ -28,13 +28,14 @@ const getIcon = icon => {
* @param menu * @param menu
*/ */
export const getFlatMenuKeys = menu => export const getFlatMenuKeys = menu =>
menu.reduce((keys, item) => { menu
keys.push(item.path); .reduce((keys, item) => {
if (item.children) { keys.push(item.path);
return keys.concat(getFlatMenuKeys(item.children)); if (item.children) {
} return keys.concat(getFlatMenuKeys(item.children));
return keys; }
}, []); return keys;
}, []);
/** /**
* Find all matched menu keys based on paths * Find all matched menu keys based on paths
...@@ -42,11 +43,11 @@ export const getFlatMenuKeys = menu => ...@@ -42,11 +43,11 @@ export const getFlatMenuKeys = menu =>
* @param paths: [/abc, /abc/11, /abc/11/info] * @param paths: [/abc, /abc/11, /abc/11/info]
*/ */
export const getMeunMatchKeys = (flatMenuKeys, paths) => export const getMeunMatchKeys = (flatMenuKeys, paths) =>
paths.reduce( paths
(matchKeys, path) => .reduce((matchKeys, path) => (
matchKeys.concat(flatMenuKeys.filter(item => pathToRegexp(item).test(path))), matchKeys.concat(
[] flatMenuKeys.filter(item => pathToRegexp(item).test(path))
); )), []);
export default class SiderMenu extends PureComponent { export default class SiderMenu extends PureComponent {
constructor(props) { constructor(props) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment