@untemps/utils - v3.2.0
    Preparing search index...

    Function clamp

    • Parameters

      • value: number

        The value to clamp.

      • min: number

        The lower bound.

      • max: number

        The upper bound.

      Returns number

      The value clamped to [min, max].

      import { clamp } from '@untemps/utils/number/clamp'

      clamp(5, 0, 10) // 5
      clamp(-3, 0, 10) // 0
      clamp(15, 0, 10) // 10
      clamp(5, 10, 0) // 5 (reversed min/max is normalized)