Skip to content

Commit 9513fc7

Browse files
committed
ast-walkers: add comment explaining searchOpts
1 parent 78f8077 commit 9513fc7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/ast-walkers.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ var TypeIndex = require('./type-index');
55
var walkers = exports;
66

77

8+
// All walkers accept `opts` arguments (occasionally referred to as
9+
// `searchOpts`) which is an object with the following fields:
10+
//
11+
// - iterator: function(node, nodeIndex, parent, [props]))
12+
// function running once for each node being walked over, in order
13+
//
14+
// - [typeIndex]: boolean=false
15+
// if true, `props` will have an integer `typeIndex` field which
16+
// represents a node index among all its sibling of the same type
17+
//
18+
19+
820
walkers.topScan = function (node, nodeIndex, parent, opts) {
921
if (parent) {
1022
// We would like to avoid spinning an extra loop through the starting

0 commit comments

Comments
 (0)