I want to limit a number between two values, I know that in PHP you can do this:
$number = min(max(intval($number), 1), 20); // this will make $number 1 if i
Use lodash's clamp method:
_.clamp(22, 1, 20) // Outputs 20