From 5bff87c5c64ad85c01875648ecdc122059ee7519 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 28 Apr 2018 21:53:22 +0300 Subject: [PATCH] tools: dedupe property access in doc/type-parser There is no need to get this property twice in this rather hot spot: if there is no such key, the `typeUrl` will be `undefined`, which suffices for the boolean check in the next line. For consistency, `undefined` can also be made the default value. --- tools/doc/type-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 6314a4889f06e6..e7a2c2576e3b66 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -130,7 +130,7 @@ function toLink(typeInput) { typeTexts.forEach((typeText) => { typeText = typeText.trim(); if (typeText) { - let typeUrl = null; + let typeUrl; // To support type[], type[][] etc., we store the full string // and use the bracket-less version to lookup the type URL. @@ -143,7 +143,7 @@ function toLink(typeInput) { typeUrl = `${jsDataStructuresUrl}#${primitive}_type`; } else if (jsGlobalTypes.includes(typeText)) { typeUrl = `${jsGlobalObjectsUrl}${typeText}`; - } else if (customTypesMap[typeText]) { + } else { typeUrl = customTypesMap[typeText]; }