File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
apps/api-documenter/src/utils Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,16 @@ export class DocItem {
157157 }
158158 return undefined ;
159159 }
160+
161+ /**
162+ * Visits this DocItem and every child DocItem in a preorder traversal.
163+ */
164+ public forEach ( callback : ( docItem : DocItem ) => void ) : void {
165+ callback ( this ) ;
166+ for ( const child of this . children ) {
167+ child . forEach ( callback ) ;
168+ }
169+ }
160170}
161171
162172/**
@@ -234,4 +244,13 @@ export class DocItemSet {
234244 result . docItem = result . closestMatch ;
235245 return result ;
236246 }
247+
248+ /**
249+ * Visits every DocItem in the tree.
250+ */
251+ public forEach ( callback : ( docItem : DocItem ) => void ) : void {
252+ for ( const docPackage of this . docPackages ) {
253+ docPackage . forEach ( callback ) ;
254+ }
255+ }
237256}
You can’t perform that action at this time.
0 commit comments