Shows values with units and multipliers, i.e., 760 Mibytes or 12 km.
If the unit is binary, «i» is appended to multiplier as suggested by IEC and IEEE.
- Number. A value, amount of something that need to be displayed for human;
- Non-negative number. Amount of decimal digits. Default: 0;
- String. Unit to be used. Default: "bytes";
- Boolean. Is this unit binary (false) or decial (true). Default: binary (false).
Isn't it possible to replace
'-kMGT'.split(/-?/)[a]
with'kMGT'.charAt(a-1)
?