mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 12:03:36 +00:00
12 lines
239 B
JavaScript
12 lines
239 B
JavaScript
|
var RoundTo = function (value, place, base)
|
||
|
{
|
||
|
if (place === undefined) { place = 0; }
|
||
|
if (base === undefined) { base = 10; }
|
||
|
|
||
|
var p = Math.pow(base, -place);
|
||
|
|
||
|
return Math.round(value * p) / p;
|
||
|
};
|
||
|
|
||
|
module.exports = RoundTo;
|