avoidwork / filesize.js

JavaScript library to generate a human readable String describing the file size
https://filesizejs.com
BSD 3-Clause "New" or "Revised" License
1.61k stars 97 forks source link

Inconsistency in tests and examples #72

Closed starius closed 8 years ago

starius commented 8 years ago

https://github.com/avoidwork/filesize.js/blob/f7a059f/test/filesize_test.js#L22

this.kilobit = 500;
// ...
test.equal(filesize(this.kilobit, {bits :true}), "3.91 Kb", "Should be '3.91 Kb'");

https://github.com/avoidwork/filesize.js/blob/f7a059f/README.md

filesize(500, {bits: true});          // "4 kb"

Discrepancies:

See also #69

avoidwork commented 8 years ago

You're welcome to change it with a PR.

avoidwork commented 8 years ago

The website is also 2-3yr out of date, please include updates there too.

starius commented 8 years ago

Ok, I'll change values in examples to what is actually returned.

starius commented 8 years ago

The website is also 2-3yr out of date, please include updates there too.

The example on the site is loaded with gist https://gist.github.com/4698968.js I can't make a pull request to gist.

starius commented 8 years ago

I'm trying to reimplement it in Lua: https://github.com/starius/lua-filesize I've used the example as the first test.

avoidwork commented 8 years ago

Ah, well I guess that's unfortunate timing; all of the tests were corrected for JEDEC/SI, because it used to be SI centric.