[Prototype-core] Re: Number.prototype - my proposal

2007-07-03 Thread Christophe Porteneuve
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

[Prototype-core] Re: Number.prototype - my proposal

2007-07-02 Thread Tobie Langel
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); }; and I'm not really sure bout the use of that method not the api. For some reason, I think it s