• Iterates over elements of collection invoking iteratee for each element. The iteratee is invoked with three arguments: (value, index|key, collection). Iteratee functions may exit iteration early by explicitly returning false.

    Note: As with other "Collections" methods, objects with a "length" property are iterated like arrays. To avoid this behavior _.forIn or _.forOwn may be used for object iteration.

    Type Parameters

    • T

    Parameters

    • collection: T[]

      The collection to iterate over.

    • Optionaliteratee: ArrayIterator<T, any>

      The function invoked per iteration.

    Returns T[]

    _.each

  • Parameters

    • collection: string
    • Optionaliteratee: StringIterator<any>

    Returns string

    _.forEach

  • Type Parameters

    • T

    Parameters

    • collection: List<T>
    • Optionaliteratee: ListIterator<T, any>

    Returns List<T>

    _.forEach

  • Type Parameters

    • T extends object

    Parameters

    • collection: T
    • Optionaliteratee: ObjectIterator<T, any>

    Returns T

    _.forEach

  • Type Parameters

    • T
    • TArray extends undefined | null | T[]

    Parameters

    • collection: TArray & (undefined | null | T[])
    • Optionaliteratee: ArrayIterator<T, any>

    Returns TArray

    _.forEach

  • Type Parameters

    • TString extends undefined | null | string

    Parameters

    • collection: TString
    • Optionaliteratee: StringIterator<any>

    Returns TString

    _.forEach

  • Type Parameters

    • T
    • TList extends undefined | null | List<T>

    Parameters

    • collection: TList & (undefined | null | List<T>)
    • Optionaliteratee: ListIterator<T, any>

    Returns TList

    _.forEach

  • Type Parameters

    • T extends object

    Parameters

    • collection: undefined | null | T
    • Optionaliteratee: ObjectIterator<T, any>

    Returns undefined | null | T

    _.forEach