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`] = `
101
101
" methods" : [
102
102
{
103
103
" description" : " Get the current working directory." ,
104
- " fullName" : " getCurrentWorkingDirectory()() " ,
105
- " name" : " getCurrentWorkingDirectory() " ,
104
+ " fullName" : " getCurrentWorkingDirectory()" ,
105
+ " name" : " getCurrentWorkingDirectory" ,
106
106
" params" : [],
107
107
" private" : false ,
108
108
" returns" : [
@@ -119,8 +119,8 @@ exports[`dox parser parse example jsdoc headers (function methods) 1`] = `
119
119
},
120
120
{
121
121
" 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" ,
124
124
" params" : [
125
125
{
126
126
" description" : " Optional path or URL." ,
Original file line number Diff line number Diff line change @@ -42,14 +42,31 @@ export const parseString = async (
42
42
types : types || [ ]
43
43
} ) ) ;
44
44
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
+
45
65
return {
46
66
type : method . ctx . type ,
47
67
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,
53
70
description : method . description . full || null ,
54
71
params,
55
72
returns,
Original file line number Diff line number Diff line change @@ -15,8 +15,10 @@ export interface Jsdoc {
15
15
code : string ;
16
16
ctx : {
17
17
type : string ;
18
+ constructor ?: string ;
19
+ cons ?: string ;
18
20
name : string ;
19
- value : string ;
21
+ value ? : string ;
20
22
string : string ;
21
23
} ;
22
24
}
You can’t perform that action at this time.
0 commit comments