numbro
numbro copied to clipboard
Support for SI units?
I would like to add another another format with the letter 'k' (similar to 'a') to indicate something should be formatted with si prefixes.
Example:
numeral(0.0000032434).format('0.0 k');
// 3.2 μ
numeral(0.0000032434).format('0.[00] k');
// 3.24 μ
I want to get some feedback to see if this makes sense to implement. If it does, I'll submit a pull request.
Thanks in advance.
+1
Sounds like it can't hurt :smile:
why the k
?
It's just the SI prefix for kilo -- we could use si
or something else if you prefer. What do you think?
ok.
the code as to be a single character
That sounds great (but the fact it's from 2015 doesn't make me hopeful :cry:)
I was looking into expressing units such as "Gbps" (gigabits per second) and "Mpps" (megapackets per second). The bytes formatting in the code handles units like MB/MiB, but seems hardcoded to express bytes, rather than any other types of units, as far as I could tell.
Perhaps another way to frame this bug is to generalize that support, and provide two types of unit prefixes, SI and IEC/IEEE?