From 125849673a1aba46021852ee473d00f4520d1bd6 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 11 Dec 2018 20:36:55 +0900 Subject: Use for-of instead of forEach (#3583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: syuilo Co-authored-by: Acid Chicken (硫酸鶏) --- src/server/web/docs.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/web/docs.ts') diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index 9cc54cdf0b..f9991fc65c 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -36,7 +36,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { const docs = glob.sync(`src/docs/**/*.${lang}.md`, { cwd }); vars['docs'] = {}; - docs.forEach(x => { + for (const x of docs) { const [, name] = x.match(/docs\/(.+?)\.(.+?)\.md$/); if (vars['docs'][name] == null) { vars['docs'][name] = { @@ -45,7 +45,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { }; } vars['docs'][name]['title'][lang] = fs.readFileSync(cwd + x, 'utf-8').match(/^# (.+?)\r?\n/)[1]; - }); + } vars['kebab'] = (string: string) => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase(); @@ -121,7 +121,7 @@ const sortParams = (params: Array<{ name: string }>) => { const extractParamDefRef = (params: Context[]) => { let defs: any[] = []; - params.forEach(param => { + for (const param of params) { if (param.data && param.data.ref) { const props = (param as ObjectContext).props; defs.push({ @@ -133,7 +133,7 @@ const extractParamDefRef = (params: Context[]) => { defs = defs.concat(childDefs); } - }); + } return sortParams(defs); }; @@ -141,7 +141,7 @@ const extractParamDefRef = (params: Context[]) => { const extractPropDefRef = (props: any[]) => { let defs: any[] = []; - Object.entries(props).forEach(([k, v]) => { + for (const [k, v] of Object.entries(props)) { if (v.props) { defs.push({ name: k, @@ -152,7 +152,7 @@ const extractPropDefRef = (props: any[]) => { defs = defs.concat(childDefs); } - }); + } return sortParams(defs); }; -- cgit v1.2.3-freya