flocore/Number.monkey.js
2013-07-18 12:01:12 -04:00

9 lines
246 B
JavaScript

exports.patch = function(Number) {
//round to specified number of places
Number.prototype.round = function(places) {
if(!places) return Math.round(this);
var tmp = Math.pow(10,places);
return Math.round(this * tmp) / tmp;
};
};