Skip to content

Commit ee13845

Browse files
committed
cleanup comment and a regex error
Signed-off-by: flakey5 <[email protected]>
1 parent 8e50047 commit ee13845

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/generators/legacy-json/utils/buildSection.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ function parseSignature(textRaw, values) {
215215
}
216216

217217
/**
218-
*
219218
* @param {Array<import('mdast').PhrasingContent>} nodes
220219
*/
221220
function textJoin(nodes) {
@@ -266,10 +265,13 @@ function parseListItem(child) {
266265
// Extract name
267266
if (RETURN_EXPRESSION.test(text)) {
268267
current.name = 'return';
269-
270-
let [, returnType] = text.match(/`(.*?)`/);
271-
returnType = returnType.substring(1, returnType.length - 1);
272-
current.type = returnType;
268+
// console.log(text)
269+
let matchResult = text.match(/`(.*?)`/);
270+
if (matchResult) {
271+
let returnType = matchResult[1];
272+
returnType = returnType.substring(1, returnType.length - 1);
273+
current.type = returnType;
274+
}
273275

274276
text = text.replace(RETURN_EXPRESSION, '');
275277
} else {
@@ -311,7 +313,6 @@ function parseListItem(child) {
311313
}
312314

313315
/**
314-
*
315316
* @param {import('../types.d.ts').HierarchizedEntry} entry
316317
* @param {import('../types.d.ts').Section} parentSection
317318
*/

0 commit comments

Comments
 (0)