Function findOneChild

  • findOneChild<T>(test: ((elem: T) => boolean), nodes: T[]): T | undefined
  • Finds the first element inside of an array that matches a test function. This is an alias for Array.prototype.find.

    Returns

    The first node in the array that passes test.

    Deprecated

    Use Array.prototype.find directly.

    Type Parameters

    • T

    Parameters

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

      Function to test nodes on.

        • (elem: T): boolean
        • Parameters

          • elem: T

          Returns boolean

    • nodes: T[]

      Array of nodes to search.

    Returns T | undefined