Options
All
  • Public
  • Public/Protected
  • All
Menu

Module inRange

Index

References

Functions Number

References

Renames and re-exports inRange

Number Functions

  • inRange(number: number, start?: number, end?: number): boolean
  • Checks if number is between start and up to, but not including, end. If end is not specified, it's set to start with start then set to 0. If start is greater than end the params are swapped to support negative ranges.

    since

    5.7.0

    see

    range,rangeRight

    example
    inRange(3, 2, 4)
    // => true

    inRange(4, 8)
    // => true

    inRange(4, 2)
    // => false

    inRange(2, 2)
    // => false

    inRange(1.2, 2)
    // => true

    inRange(5.2, 4)
    // => false

    inRange(-3, -2, -6)
    // => true

    Parameters

    • number: number

      The number to check.

    • Optional start: number

      The start of the range.

    • Optional end: number

      The end of the range.

    Returns boolean

    Returns true if number is in the range, else false.