clamp
clamp takes 3 arguments - target number, lower bound and upper bound.
It returns closest number to the target between bounds.
import { clamp } from '@krutoo/utils';
const validAge = clamp(user.age, 0, 100);
clampclamp takes 3 arguments - target number, lower bound and upper bound.
It returns closest number to the target between bounds.
import { clamp } from '@krutoo/utils';
const validAge = clamp(user.age, 0, 100);