MCPcopy Index your code
hub / github.com/ampproject/amphtml / deepScan

Function deepScan

src/core/context/scan.js:42–59  ·  view source on GitHub ↗
(
  startNode,
  callback,
  arg = undefined,
  state = /** @type {S} */ (/** @type {?} */ (true)),
  includeSelf = true
)

Source from the content-addressed store, hash-verified

40 * @template S
41 */
42export 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}

Callers 4

setMethod · 0.90
removeMethod · 0.90
parentUpdatedMethod · 0.90

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected