Number#limit method
Reported by MadRabbit | May 7th, 2010 @ 05:30 PM | 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 May 22nd, 2010 @ 12:15 PM
- State changed from new to resolved
I've added two methods instead
min
andmax
, 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