Function find

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

    Parameters

    • test: (elem: AnyNode) => boolean

      Function to test nodes on.

    • nodes: ParentNode | 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.