mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 11:42:36 +01:00
commit
118c91549d
10
snippets.js
10
snippets.js
@ -253,3 +253,13 @@ RegExp.prototype.url_regex = function() {
|
||||
);
|
||||
return reg;
|
||||
}
|
||||
|
||||
Number.prototype.numberFormat = function(dec_places){
|
||||
//TODO Possibly abstract this to some sort of localisation module in future?
|
||||
var dec_point = '.';
|
||||
var sep = ',';
|
||||
|
||||
var parts = this.toFixed(dec_places).toString().split(dec_point);
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, sep);
|
||||
return parts.join(dec_point);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user