@@ -15,49 +15,40 @@ const formatStringForUID = content =>
1515 . replace ( / ^ - | - $ / g, '' ) ;
1616
1717const parser = ( content , filename ) =>
18- dox . parseComments ( content , { 'raw' : true } ) . reduce ( ( prev , curr ) => {
19-
20- if ( ! curr . ignore && curr . ctx ) {
21-
22- prev . push ( {
23- 'uid' : formatStringForUID ( `${ filename } -${ curr . ctx . string } ` ) ,
24- 'isPrivate' : curr . isPrivate ,
25- 'type' : curr . ctx . type ,
26- 'name' : formatStringForName ( curr . ctx . string ) ,
27- 'description' : curr . description . full ,
28- 'params' : curr . tags . filter ( tag =>
29- tag . type === 'param' && ! tag . name . match ( / \. / ) )
30- . map ( tag => formatStringForParam ( tag . name ) )
31- . join ( ', ' ) ,
32- 'tags' : {
33- 'example' : curr . tags . filter ( tag => tag . type === 'example' )
34- . map ( tag => tag . string ) ,
35- 'param' : curr . tags . filter ( tag => tag . type === 'param' )
36- . map ( tag => ( {
37- 'name' : formatStringForParam ( tag . name ) ,
38- 'isOptional' : tag . optional ,
39- 'types' : tag . types ,
40- 'description' : tag . description
41- } ) ) ,
42- 'property' : curr . tags . filter ( tag => tag . type === 'property' )
18+ dox . parseComments ( content , { 'raw' : true } ) . filter ( method => ! method . ignore && method . ctx )
19+ . map ( method => ( {
20+ 'uid' : formatStringForUID ( `${ filename } -${ method . ctx . string } ` ) ,
21+ 'isPrivate' : method . isPrivate ,
22+ 'type' : method . ctx . type ,
23+ 'name' : formatStringForName ( method . ctx . string ) ,
24+ 'description' : method . description . full ,
25+ 'params' : method . tags . filter ( tag =>
26+ tag . type === 'param' && ! tag . name . match ( / \. / ) )
27+ . map ( tag => formatStringForParam ( tag . name ) )
28+ . join ( ', ' ) ,
29+ 'tags' : {
30+ 'example' : method . tags . filter ( tag => tag . type === 'example' )
31+ . map ( tag => tag . string ) ,
32+ 'param' : method . tags . filter ( tag => tag . type === 'param' )
33+ . map ( tag => ( {
34+ 'name' : formatStringForParam ( tag . name ) ,
35+ 'isOptional' : tag . optional ,
36+ 'types' : tag . types ,
37+ 'description' : tag . description
38+ } ) ) ,
39+ 'property' : method . tags . filter ( tag => tag . type === 'property' )
40+ . map ( tag => ( {
41+ 'name' : tag . name ,
42+ 'types' : tag . types ,
43+ 'description' : tag . description
44+ } ) ) ,
45+ 'return' : method . tags . filter ( tag =>
46+ tag . type === 'return' || tag . type === 'returns' )
4347 . map ( tag => ( {
44- 'name' : tag . name ,
4548 'types' : tag . types ,
4649 'description' : tag . description
47- } ) ) ,
48- 'return' : curr . tags . filter ( tag =>
49- tag . type === 'return' || tag . type === 'returns' )
50- . map ( tag => ( {
51- 'types' : tag . types ,
52- 'description' : tag . description
53- } ) )
54- }
55- } ) ;
56-
57- }
58-
59- return prev ;
60-
61- } , [ ] ) ;
50+ } ) )
51+ }
52+ } ) ) ;
6253
6354module . exports = parser ;
0 commit comments