Closed starius closed 8 years ago
Don't care.
It is not clear. What is the expected result of filesize(10e40)
? Currently I get "82718061255302770 YB", but maybe "8.27e+16 YB" or even "1e+41 B" is better?
Why is that better? This module is approaching 4 million downloads on npm, and you're the first person to raise this concern. Could you explain it in further detail.
IMO, scientific notation doesn't equate to 'human readable', which why it's never output that. It could of course become a customizable output, and if you would like to see that I'd be willing to take your PR to introduce it.
This module is approaching 4 million downloads on npm, and you're the first person to raise this concern.
There is a first time for everything :)
I noticed this while measuring coverage of my Lua version of this function. That line was the only uncovered line in the code. In Lua it becomes scientific notation and in JavaScript it is a plain integer representation.
IMO, scientific notation doesn't equate to 'human readable'
+1 for this. So "82718061255302770 YB" should be the expected output. I am going to open a pull request adding such test.
The following case is not tested: