@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function clamp

    • Clamps value to the inclusive range [min, max].

      Parameters

      • value: number

        The number to clamp.

      • min: number

        Lower bound.

      • max: number

        Upper bound.

      Returns number

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