UNPKG
tf2-rtp-calculator
Version:
latest (1.1.0)
1.1.0
1.0.0
An RTP calculator for Team Fortress 2 crate unbox sessions
tf2-rtp-calculator
/
src
/
shared
/
roundNumToPlace.ts
7 lines
•
247 B
text/typescript
View Raw
1
2
3
4
5
6
7
export
function
roundNumToPlace
(
num
:
number
,
places
:
number
):
number
{
if
(places <
0
) {
throw
new
Error
(
"Number of places must be non-negative"
); }
const
factor =
Math
.
pow
(
10
, places);
return
Math
.
round
(num * factor) / factor; }