Skip to content

Commit b0c0352

Browse files
vsemozhetbytMylesBorins
authored andcommitted
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: #20387 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent fcc5492 commit b0c0352

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/doc/type-parser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function toLink(typeInput) {
130130
typeTexts.forEach((typeText) => {
131131
typeText = typeText.trim();
132132
if (typeText) {
133-
let typeUrl = null;
133+
let typeUrl;
134134

135135
// To support type[], type[][] etc., we store the full string
136136
// and use the bracket-less version to lookup the type URL.
@@ -143,7 +143,7 @@ function toLink(typeInput) {
143143
typeUrl = `${jsDataStructuresUrl}#${primitive}_type`;
144144
} else if (jsGlobalTypes.includes(typeText)) {
145145
typeUrl = `${jsGlobalObjectsUrl}${typeText}`;
146-
} else if (customTypesMap[typeText]) {
146+
} else {
147147
typeUrl = customTypesMap[typeText];
148148
}
149149

0 commit comments

Comments
 (0)