Function find

  • Search an array of nodes and their children for nodes passing a test function.

    Parameters

    • test: ((elem) => boolean)

      Function to test nodes on.

        • (elem): boolean
        • Parameters

          • elem: AnyNode

          Returns boolean

    • nodes: AnyNode[]

      Array of nodes to search.

    • recurse: boolean

      Also consider child nodes.

    • limit: number

      Maximum number of nodes to return.

    Returns AnyNode[]

    All nodes passing test.