Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8942581

Browse filesBrowse files
vsemozhetbytjasnell
authored andcommitted
doc: support multidimensional arrays in type link
Currently, we have at least one multidimensional array in type signature: see `records` parameter in https://nodejs.org/api/dns.html#dns_dns_resolvetxt_hostname_callback Our type parser does not linkify these signatures properly. This PR tries to fix this. PR-URL: nodejs#16207 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
1 parent 70896c7 commit 8942581
Copy full SHA for 8942581

File tree

Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎tools/doc/type-parser.js‎

Copy file name to clipboardExpand all lines: tools/doc/type-parser.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ const typeMap = {
5858
'URLSearchParams': 'url.html#url_class_urlsearchparams'
5959
};
6060

61+
const arrayPart = /(?:\[])+$/;
62+
6163
module.exports = {
6264
toLink: function(typeInput) {
6365
const typeLinks = [];
@@ -69,12 +71,10 @@ module.exports = {
6971
if (typeText) {
7072
let typeUrl = null;
7173

72-
// To support type[], we store the full string and use
73-
// the bracket-less version to lookup the type URL
74+
// To support type[], type[][] etc., we store the full string
75+
// and use the bracket-less version to lookup the type URL
7476
const typeTextFull = typeText;
75-
if (/\[]$/.test(typeText)) {
76-
typeText = typeText.slice(0, -2);
77-
}
77+
typeText = typeText.replace(arrayPart, '');
7878

7979
const primitive = jsPrimitives[typeText.toLowerCase()];
8080

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.