2007-06-06 16:10:16 +00:00
|
|
|
Object.extend(Number.prototype, {
|
|
|
|
toColorPart: function() {
|
|
|
|
return this.toPaddedString(2, 16);
|
|
|
|
},
|
|
|
|
|
|
|
|
succ: function() {
|
|
|
|
return this + 1;
|
|
|
|
},
|
|
|
|
|
2008-05-05 13:17:08 +00:00
|
|
|
times: function(iterator, context) {
|
|
|
|
$R(0, this, true).each(iterator, context);
|
2007-06-06 16:10:16 +00:00
|
|
|
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
|
|
|
});
|