Skip to main content

Function: walk()

walk(root, visit, seen?): void

Defined in: packages/core/src/core/walk.ts:45

Visit root and every node reachable from it, depth first, parents before children and children in the order describe() lists them.

Each node is described and descended into once. Arriving at it again — a node two parents share, or a hand-rolled node that reports itself — is still visited, with first set, so a consumer can record the reference; one that wants each node once skips those. Pass seen to share the guard across several roots.

Parameters​

root​

Processable

visit​

(visit) => void

seen?​

Map<Processable<unknown, unknown>, WalkVisit> = ...

Returns​

void