deno.land / x / rambda@v9.1.1 / src / clamp.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { curry } from './curry.js'
function clampFn( min, max, input){ if (min > max){ throw new Error('min must not be greater than max in clamp(min, max, value)') } if (input >= min && input <= max) return input
if (input > max) return max if (input < min) return min}
export const clamp = curry(clampFn)
rambda

Version Info

Tagged at
7 months ago