@trashpanda001/helpers
    Preparing search index...

    Function clamp

    • Clamp a number between a min and max value.

      Parameters

      • value: number

        the number to clamp

      • min: number

        the minimum value

      • max: number

        the maximum value

      Returns number

      the clamped value

      import { clamp } from "@trashpanda001/helpers/number"

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