forked from 0x2620/oxjs
improve Ox.formatValue
This commit is contained in:
parent
211abb10ab
commit
7818d4deb6
2 changed files with 5 additions and 5 deletions
|
|
@ -545,9 +545,9 @@ Ox.formatValue = function(num, str, bin) {
|
|||
len = Ox.PREFIXES.length,
|
||||
val;
|
||||
Ox.forEach(Ox.PREFIXES, function(chr, i) {
|
||||
if (num < Math.pow(base, i + 2) || i == len - 1) {
|
||||
val = Ox.formatNumber(num / Math.pow(base, i + 1), i) +
|
||||
' ' + chr + (bin ? 'i' : '') + str;
|
||||
if (num < Math.pow(base, i + 1) || i == len - 1) {
|
||||
val = Ox.formatNumber(num / Math.pow(base, i), i) +
|
||||
' ' + chr + (chr && bin ? 'i' : '') + str;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue