Function range

  • Find the range of an array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      An array.

    • Optional iteratee: ((obj) => number)

      The iteratee invoked on each element.

        • (obj): number
        • Parameters

          • obj: T

          Returns number

    Returns number

    Returns the range.

    Since

    0.5.1

    Example

    range([1, 2, 3])
    // => 2

    const range = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]
    range(objects, ({ n }) => n)
    // => 6