3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

fix: crash on tag round() with non-numeric argument

This commit is contained in:
Dragory 2023-11-18 12:57:54 +02:00
parent 062cb053cc
commit 9fd2bf4edb
No known key found for this signature in database

View file

@ -418,7 +418,10 @@ const baseValues = {
return Math.round(randValue * (to - from) + from);
},
round(arg, decimals = 0) {
if (isNaN(arg)) return 0;
if (typeof arg !== "number") {
arg = parseFloat(arg);
}
if (Number.isNaN(arg)) return 0;
return decimals === 0 ? Math.round(arg) : arg.toFixed(Math.max(0, Math.min(decimals, 100)));
},
add(...args) {