Function _findIndex

  • Find element's index/key in array or object for which provided function returns true

    Until element is found, provided function is called for each element with arguments: current element, current index/key and initial container.

    If searched element is not found, undefined is returned.

    Type Parameters

    • T

    Parameters

    • fn: ((val, index?, arr?) => boolean)
        • (val, index?, arr?): boolean
        • Parameters

          • val: T
          • Optional index: number
          • Optional arr: T

          Returns boolean

    • arr: T[]

    Returns number | undefined

  • Type Parameters

    • T

    Parameters

    • fn: ((val, key?, obj?) => boolean)
        • (val, key?, obj?): boolean
        • Parameters

          • val: T
          • Optional key: string
          • Optional obj: Record<string, T>

          Returns boolean

    • obj: Record<string, T>

    Returns string | undefined