(
startNode,
callback,
arg = undefined,
state = /** @type {S} */ (/** @type {?} */ (true)),
includeSelf = true
)
| 40 | * @template S |
| 41 | */ |
| 42 | export function deepScan( |
| 43 | startNode, |
| 44 | callback, |
| 45 | arg = undefined, |
| 46 | state = /** @type {S} */ (/** @type {?} */ (true)), |
| 47 | includeSelf = true |
| 48 | ) { |
| 49 | if (includeSelf) { |
| 50 | const newState = callback(startNode, arg, state); |
| 51 | if (newState) { |
| 52 | deepScan(startNode, callback, arg, newState, false); |
| 53 | } |
| 54 | } else if (startNode.children) { |
| 55 | for (const node of startNode.children) { |
| 56 | deepScan(node, callback, arg, state, true); |
| 57 | } |
| 58 | } |
| 59 | } |
no test coverage detected