:gift: In case anyone finds it useful, here's a :...
# multiplatform
d
🎁 In case anyone finds it useful, here's a Human Readable Data Size formatting function that uses only Kotlin Multiplatform Common API's. Just drop it into your common source set & go 😄 Other implementations I found stackoverflow either use string formatting or other functions not found in 'common Kotlin'; this gets it done with what's available. Welcome any suggestions for improvement!
👍🏼 1
👍 7
e
Copy code
abs(Long.MIN_VALUE) < 0
blob scream 1
d
Just made it throw an error for now in that unlikely edge case; but nice pickup!
e
require(byteCount>Long.MIN_VALUE) { "Out of range" }
How would it be possible to be less than
MIN_VALUE
in the first place?
e
could be equal
I imagine it's only likely to come up if you were using it as a sentinel value, but it's definitely annoying to handle
👀 1
👍 1
e
🤦‍♂️