Options
All
  • Public
  • Public/Protected
  • All
Menu

Module rangeRight

Index

References

Functions Util

References

Renames and re-exports rangeRight

Util Functions

  • rangeRight(start: number, end?: number, step?: number): number[]
  • This method is like range except that it populates values in descending order.

    since

    5.7.0

    see

    inRange,range

    example
    rangeRight(4)
    // => [3, 2, 1, 0]

    rangeRight(-4)
    // => [-3, -2, -1, 0]

    rangeRight(1, 5)
    // => [4, 3, 2, 1]

    rangeRight(0, 20, 5)
    // => [15, 10, 5, 0]

    rangeRight(0, -4, -1)
    // => [-3, -2, -1, 0]

    rangeRight(1, 4, 0)
    // => [1, 1, 1]

    rangeRight(0)
    // => []

    Parameters

    • start: number

      The start of the range.

    • Optional end: number

      The end of the range.

    • Optional step: number

      The value to increment or decrement by.

    Returns number[]

    Returns the range of numbers.