Number#limit method
Reported by MadRabbit | 2010-05-07 17:30:14 UTC | in 2.0.0 Release
It's pretty common to limit a numeric value in some constraints like
var number = 2;
if (number < 0) number = 0;
if (number > 4) number = 4;
// would be cool to make it like that
number = number.limit(0, 4);
Comments and changes to this ticket
-

MadRabbit 2010-05-22 12:15:46 UTC
- State changed from new to resolved
I've added two methods instead
minandmax, and the code looks like thatvar number = 2.min(0).max(4);
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
RightJS Core Tickets