Function clamper

Returns a function that clamps values.

const c = clamper(0,100);
c(50); // 50
c(101); // 100
c(-5); // 0
  • Parameters

    • min: number = 0

      Minimum value. Default: 0

    • max: number = 1

      Maximum value. Default: 1

    Returns ((v: number) => number)

      • (v): number
      • Parameters

        • v: number

        Returns number