Function find

  • find(test: ((elem: AnyNode) => boolean), nodes: AnyNode[], recurse: boolean, limit: number): AnyNode[]
  • Search an array of nodes and their children for nodes passing a test function.

    Returns

    All nodes passing test.

    Parameters

    • test: ((elem: AnyNode) => boolean)

      Function to test nodes on.

        • (elem: AnyNode): 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[]