File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -121,5 +121,9 @@ output.forEach(function (def) {
121121 } ) ;
122122} ) ;
123123
124+ if ( process . argv [ 2 ] != "--documentation" ) {
125+ utils . filterDocumentation ( output ) ;
126+ }
127+
124128fs . writeFileSync ( path . join ( __dirname , "idefs.json" ) ,
125129 JSON . stringify ( output , null , 2 ) ) ;
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ var Utils = {
125125 _ . merge ( field , callbackDefs [ field . type ] ) ;
126126 }
127127 else {
128- console . log ( "WARNGING : Couldn't find callback definition for " + field . type ) ;
128+ console . log ( "WARNING : Couldn't find callback definition for " + field . type ) ;
129129 }
130130 } ,
131131
@@ -319,6 +319,48 @@ var Utils = {
319319 }
320320
321321 _ . merge ( fnDef , _ . omit ( fnOverrides , "args" , "return" ) ) ;
322+ } ,
323+
324+ filterIgnored : function ( arr , callback ) {
325+ for ( var i = arr . length - 1 ; i >= 0 ; i -- ) {
326+ if ( arr [ i ] . ignore ) {
327+ arr . splice ( i , 1 ) ;
328+ }
329+ else if ( callback ) {
330+ callback ( arr [ i ] ) ;
331+ }
332+ }
333+ } ,
334+
335+ deleteProperties : function ( obj ) {
336+ delete obj . line ;
337+ delete obj . lineto ;
338+ delete obj . block ;
339+ delete obj . description ;
340+ delete obj . comments ;
341+ delete obj . tdef ;
342+ delete obj . decl ;
343+ delete obj . comments ;
344+ delete obj . argline ;
345+ delete obj . sig ;
346+ } ,
347+
348+ filterDocumentation : function ( idefs ) {
349+ Utils . filterIgnored ( idefs , function ( idef ) {
350+ Utils . deleteProperties ( idef ) ;
351+
352+ Utils . filterIgnored ( idef . fields , Utils . deleteProperties ) ;
353+
354+
355+ Utils . filterIgnored ( idef . functions , function ( fn ) {
356+ Utils . deleteProperties ( fn ) ;
357+
358+ Utils . filterIgnored ( fn . args , function ( arg ) {
359+ Utils . deleteProperties ( arg ) ;
360+ delete arg . functions ;
361+ } ) ;
362+ } ) ;
363+ } ) ;
322364 }
323365} ;
324366
You can’t perform that action at this time.
0 commit comments