File tree Expand file tree Collapse file tree 3 files changed +29
-10
lines changed
packages/doxdox-parser-dox/src Expand file tree Collapse file tree 3 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -101,8 +101,8 @@ exports[`dox parser parse example jsdoc headers (function methods) 1`] = `
101101 " methods" : [
102102 {
103103 " description" : " Get the current working directory." ,
104- " fullName" : " getCurrentWorkingDirectory()() " ,
105- " name" : " getCurrentWorkingDirectory() " ,
104+ " fullName" : " getCurrentWorkingDirectory()" ,
105+ " name" : " getCurrentWorkingDirectory" ,
106106 " params" : [],
107107 " private" : false ,
108108 " returns" : [
@@ -119,8 +119,8 @@ exports[`dox parser parse example jsdoc headers (function methods) 1`] = `
119119 },
120120 {
121121 " description" : " Get the root directory of the package, supplied path or URL." ,
122- " fullName" : " getRootDirPath()( url)" ,
123- " name" : " getRootDirPath() " ,
122+ " fullName" : " getRootDirPath(url)" ,
123+ " name" : " getRootDirPath" ,
124124 " params" : [
125125 {
126126 " description" : " Optional path or URL." ,
Original file line number Diff line number Diff line change @@ -42,14 +42,31 @@ export const parseString = async (
4242 types : types || [ ]
4343 } ) ) ;
4444
45+ const isFunction =
46+ params . length > 0 ||
47+ method . ctx . type === 'constructor' ||
48+ method . ctx . type === 'method' ||
49+ method . ctx . type === 'function' ||
50+ ( method . ctx . type === 'declaration' &&
51+ ( method . ctx . value ?. match ( / ^ ( a s y n c ) ? \( / ) ||
52+ method . ctx . string ?. match ( / \) $ / ) ) ) ;
53+
54+ const name = method . ctx . cons
55+ ? `${ method . ctx . cons } .${ method . ctx . name } `
56+ : method . ctx . name ;
57+
58+ const fullName = isFunction
59+ ? `${ name } (${ params
60+ . map ( param => param . name )
61+ . filter ( name => name && ! name . match ( / \. / ) )
62+ . join ( ', ' ) } )`
63+ : name ;
64+
4565 return {
4666 type : method . ctx . type ,
4767 slug : `${ slugify ( path ) } -${ slugify ( method . ctx . string ) } ` ,
48- name : method . ctx . string ,
49- fullName : `${ method . ctx . string } (${ params
50- . map ( param => param . name )
51- . filter ( name => name && ! name . match ( / \. / ) )
52- . join ( ', ' ) } )`,
68+ name,
69+ fullName,
5370 description : method . description . full || null ,
5471 params,
5572 returns,
Original file line number Diff line number Diff line change @@ -15,8 +15,10 @@ export interface Jsdoc {
1515 code : string ;
1616 ctx : {
1717 type : string ;
18+ constructor ?: string ;
19+ cons ?: string ;
1820 name : string ;
19- value : string ;
21+ value ? : string ;
2022 string : string ;
2123 } ;
2224}
You can’t perform that action at this time.
0 commit comments