Appearance
返回三个值当中的中间值,即非最大最小值
export const clamp = (num: number, min: number, max: number) => Math.min(max, Math.max(min, num))
import { clamp } from '@hex-tool/shared' clamp(2, 1, 5) // 2