A search algorithm that can be used in node search. See BaseNode.Class.search.

interface Search<V, N> {
    search: ((root: N) => Generator<V, any, any>);
}

Type Parameters

Implemented by

Properties

Properties

search: ((root: N) => Generator<V, any, any>)

Starts a search from a given root node. This method is a generator, so it is usually implemented like:

export default class MySearch implements Node.Search {
*search(root: BaseNode.Class): Generator<SearchVisit> {
// Your implementation here
}
}

And uses the yield keyword to return values.

Type declaration

    • (root): Generator<V, any, any>
    • Parameters

      • root: N

        The root node to start the search from.

      Returns Generator<V, any, any>

      A generator that yields each visit, so that it can be lazily iterated over.