• Invoke a function for each value in an iterable.

    Type Parameters

    • T

    Parameters

    • object: Iterable<T>

      The iterable object of interest.

    • fn: ((value, index) => boolean | void)

      The callback function to invoke for each value.

      Notes

      Iteration can be terminated early by returning false from the callback function.

      Complexity

      Linear.

      Example

      import { each } from '@lumino/algorithm';

      let data = [5, 7, 0, -2, 9];

      each(data, value => { console.log(value); });
        • (value, index): boolean | void
        • Parameters

          • value: T
          • index: number

          Returns boolean | void

    Returns void

    Deprecated