SPeCS Packages Documentation
    Preparing search index...

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

    interface Search<
        V extends SearchVisit = SearchVisit,
        N extends BaseNode.Class = BaseNode.Class,
    > {
        search: (root: N) => Generator<V>;
    }

    Type Parameters

    Implemented by

    Index

    Properties

    Properties

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

    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: N): Generator<V>
      • Parameters

        • root: N

          The root node to start the search from.

        Returns Generator<V>

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