summaryrefslogtreecommitdiff
path: root/tools/doc
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-04-28 21:53:22 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-05-02 05:50:01 +0300
commit1c530e89ed1e3a07582bcb73cc72bd4d454ba562 (patch)
tree392ff04bb5bdf6a88da97ff97e69f375aed0fb78 /tools/doc
parent64a37654ce36236640782295ba217733febcba9e (diff)
downloadandroid-node-v8-1c530e89ed1e3a07582bcb73cc72bd4d454ba562.tar.gz
android-node-v8-1c530e89ed1e3a07582bcb73cc72bd4d454ba562.tar.bz2
android-node-v8-1c530e89ed1e3a07582bcb73cc72bd4d454ba562.zip
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. PR-URL: https://github.com/nodejs/node/pull/20387 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'tools/doc')
-rw-r--r--tools/doc/type-parser.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js
index 6314a4889f..e7a2c2576e 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];
}