From fad3f4ac7c391ee80e545a4c904d0f4ab3847dd4 Mon Sep 17 00:00:00 2001 From: Alan Wei Date: Fri, 4 May 2018 17:56:23 +0800 Subject: [PATCH] tweak code to keep coding style consistency --- src/components/SiderMenu/SiderMenu.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 9b7300f9..f1b44f55 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/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) { -- GitLab