@yesstudio/yes-utils
    Preparing search index...

    Function clamp

    • Clamps number within the inclusive range specified by start and end.

      Parameters

      • number: number

        The number to clamp.

      • start: number

        The start of the range.

      • end: number

        The end of the range.

      Returns number

      Returns the clamped number.

      clamp(0, 0, 10)
      // => 0

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

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