UNPKG
@edsilv/exjs
Version:
latest (0.5.1)
0.5.1
Extension library
github.com/BSick7/exjs
BSick7/exjs
@edsilv/exjs
/
src
/
round.ts
9 lines
•
278 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
namespace
exjs
{
export
function
round
(
value
:
number
,
digits
?:
number
) { digits = digits ||
0
;
if
(digits ===
0
)
return
Math
.
round
(value);
var
shift =
Math
.
pow
(
10
, digits);
return
Math
.
round
(value * shift) / shift; } }