@blockchaincommons/envelope - v1.0.0-beta.4
    Preparing search index...

    Type Alias Visitor<State>

    Visitor: (
        envelope: Envelope,
        level: number,
        incomingEdge: EdgeType,
        state: State,
    ) => [State, boolean]

    A visitor function that is called for each element in the envelope.

    The visitor function takes the following parameters:

    • envelope: The current envelope element being visited
    • level: The depth level in the hierarchy (0 for root)
    • incomingEdge: The type of edge connecting this element to its parent
    • state: Optional context passed down from the parent's visitor call

    The visitor returns a tuple of:

    • The state that will be passed to child elements
    • A boolean indicating whether to stop traversal (true = stop)

    This enables accumulating state or passing context during traversal.

    Type Parameters

    • State

    Type Declaration