2007-06-06 16:10:16 +00:00
|
|
|
Object.extend(Number.prototype, {
|
|
|
|
toColorPart: function() {
|
|
|
|
return this.toPaddedString(2, 16);
|
|
|
|
},
|
|
|
|
|
|
|
|
succ: function() {
|
|
|
|
return this + 1;
|
|
|
|
},
|
|
|
|
|
|
|
|
times: function(iterator) {
|
|
|
|
$R(0, this, true).each(iterator);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
toPaddedString: function(length, radix) {
|
|
|
|
var string = this.toString(radix || 10);
|
|
|
|
return '0'.times(length - string.length) + string;
|
|
|
|
},
|
|
|
|
|
|
|
|
toJSON: function() {
|
|
|
|
return isFinite(this) ? this.toString() : 'null';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$w('abs round ceil floor').each(function(method){
|
2007-08-07 19:41:13 +00:00
|
|
|
Number.prototype[method] = Math[method].methodize();
|
2007-06-06 16:10:16 +00:00
|
|
|
});
|