HubSpot / humanize

A simple utility library for making the web more humane. #hubspot-open-source
MIT License
915 stars 75 forks source link

Add percision parameter to fileSize #61

Closed nathancahill closed 8 years ago

nathancahill commented 9 years ago

Sometimes 3 MB is more humane than 3.12 MB. This allows specifying the precision as a parameter of fileSize() instead of having it hardcoded as 2:

Humanize.fileSize(1024 * 2000, 0)
// "1 Mb"
aaylward commented 9 years ago

thanks @nathancahill That seems legit to me. Mind adding a test for it?

@b-ash do we still support node 0.8?

b-ash commented 9 years ago

0.8 is pretty old, so I'd be okay with bailing on it.

hijonathan commented 9 years ago

https://www.youtube.com/watch?v=1IOukA10QeQ

nathancahill commented 9 years ago

Bump, added a test for file precision.

geekjuice commented 8 years ago

@nathancahill Sorry for the delayed responses :disappointed: Mind rebasing/re-applying these changes to the new source? I'll be sure to merge it in right away :+1:

nathancahill commented 8 years ago

Thanks @geekjuice! Submitted #70.