Function findOneChild

  • Finds the first element inside of an array that matches a test function. This is an alias for Array.prototype.find.

    Type Parameters

    • T

    Parameters

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

      Function to test nodes on.

        • (elem): boolean
        • Parameters

          • elem: T

          Returns boolean

    • nodes: T[]

      Array of nodes to search.

    Returns T | undefined

    The first node in the array that passes test.

    Use Array.prototype.find directly.