mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
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>
This commit is contained in:
1 parent
fcc5492df2
commit
b0c0352742
1 file changed
+2
-2
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user