fix: 单位转换方法参数为0时不返回单位

This commit is contained in:
chenjinsong
2023-02-08 15:54:32 +08:00
parent cccc1f0e6a
commit 63ab36f4d2

View File

@@ -17,6 +17,9 @@ function asciiCompute (num, ascii = 1000, units, dot = 2) {
return ['', '']
}
num = Number(num)
if (num === 0) {
return [0, '']
}
let carry = 0
if (num > 1) {
const log = Math.log(num) / Math.log(ascii)