Options
All
  • Public
  • Public/Protected
  • All
Menu

Module clamp

Index

References

Functions Number

References

Renames and re-exports clamp

Number Functions

  • clamp(num: number, lower?: number, upper?: number): number
  • Clamps number within the inclusive lower and upper bounds.

    since

    5.7.0

    example
    clamp(-10, -5, 5)
    // => -5

    clamp(10, -5, 5)
    // => 5

    Parameters

    • num: number

      The number to clamp.

    • Optional lower: number

      The lower bound.

    • Optional upper: number

      The upper bound.

    Returns number

    Returns the clamped number.