clamp
最大値 max を上限、最小値 min を下限として、入力パラメータ num をクランプする。
Added in v0.0.6
Usage
ts
import { clamp } from 'parsnip-kit'
clamp(5, 0, 10) // 5
clamp(-5, 0, 10) // 0
clamp(15, 0, 10) // 10
clamp(100) // 100API
Arguments
| Arg | Type | Optional | Default | Description |
|---|---|---|---|---|
num | number | false | undefined | クランプする数値 |
min | number | true | -Infinity | 最小値 |
max | number | true | Infinity | 最大値 |
Returns
| Type |
|---|
number |