inter icon indicating copy to clipboard operation
inter copied to clipboard

makeFileSizeRenderer, always showing size with in GB

Open mwoc opened this issue 11 years ago • 1 comments

For makeFileSizeRenderer, I've got a use case for always showing the size in GB, even though the size might be just a few bytes.

If I were to make a pull request to add such support, would you also like me to rewrite the function so it doesn't use the Function constructor, but just return a normal function instead?

mwoc avatar Jun 06 '14 11:06 mwoc

At present makeFileSizeRenderer doesn't even get i18ned units from CLDR. They're hardcoded because the correct units weren't available when I wrote the first version of it. They are there now (<unit type="digital-{byte,kilobyte,megabyte,gigabyte,terabyte}">), so the first order of business should be to start using them.

And yeah, it was written back in my wild days when performance of seemingly trivial things was more important, so it uses new Function heavily, which is harder to maintain. Also, it's causing trouble with using inter in restrictive runtimes that liken it to eval. I'd be perfectly ok with letting go of it.

papandreou avatar Dec 17 '15 07:12 papandreou