Options
All
  • Public
  • Public/Protected
  • All
Menu

Module findLast

Index

References

Functions Collection

References

Renames and re-exports findLast

Collection Functions

  • findLast<T>(collection: ArrayLike<T>, predicate?: string, fromIndex?: number): T | undefined
  • findLast<T>(collection: ArrayLike<T>, predicate?: (item: T) => boolean, fromIndex?: number): T | undefined
  • findLast<T>(collection: ArrayLike<T>, predicate?: Partial<T>, fromIndex?: number): T | undefined
  • findLast<T>(collection: ArrayLike<T>, predicate?: any, fromIndex?: number): T | undefined
  • This method is like find except that it iterates over elements of collection from right to left.

    since

    5.2.0

    see

    find,findIndex,findKey,findLastIndex,findLastKey

    example
    findLast([1, 2, 3, 4], n => n % 2 == 1)
    // => 3

    Type parameters

    • T

    Parameters

    • collection: ArrayLike<T>

      The collection to inspect.

    • Optional predicate: string

      The function invoked per iteration.

    • Optional fromIndex: number

      The index to search from.

    Returns T | undefined

    Returns the matched element, else undefined.

  • Type parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optional predicate: (item: T) => boolean
        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    • Optional fromIndex: number

    Returns T | undefined

  • Type parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optional predicate: Partial<T>
    • Optional fromIndex: number

    Returns T | undefined

  • Type parameters

    • T

    Parameters

    • collection: ArrayLike<T>
    • Optional predicate: any
    • Optional fromIndex: number

    Returns T | undefined