Tobie Langel a écrit :
> Hi Andi,
> You can open a ticket for this, but it'll need tests.
> I'd favor a more concise notation:
> Number.prototype.setInRange = function(from, to) {
>   return Math.min(Math.max(from, this), to);
>  };

For performance's sake:

Number.prototype.constrain = function(from, to) {
  return this < from ? from : (this > to ? to : this);

> For some reason, I think it should be tied to $R more closely.

Good point.

Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain

You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to