@arcmantle/library
    Preparing search index...

    Function clamp

    • Clamps a numeric value within a specified range.

      Ensures that the given value falls between the minimum and maximum bounds. If the value is less than the minimum, returns the minimum. If the value is greater than the maximum, returns the maximum. Otherwise, returns the original value unchanged.

      Parameters

      • min: number

        The minimum allowed value (inclusive)

      • value: number

        The value to clamp

      • max: number

        The maximum allowed value (inclusive)

      Returns number

      The clamped value within the range [min, max]

      minmax(0, -5, 10);  // Returns 0
      minmax(0, 5, 10); // Returns 5
      minmax(0, 15, 10); // Returns 10