You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the note and sorry for the delay—new job uses GitHub also so my mentions have been destroyed! So what's happening here is, because you omit the first argument, we assume you want the left/starting point to be the first symbol in your universe, i.e., 0. Therefore, when you give 0+ as the right/end, the library errors out since there's no space 0 and 0, just as there's no space between 0 and 000.
Does that make sense? You can't find a string that's lexicographically between 0 and 00 in base62.
Note that this works: mudder.base62.mudder('00', ''), i.e., you've flipped the arguments and provided the left/start, and the library will use the last symbol (z) as the right/end since you've omitted it. Would this work for you?
@fasiha , please don’t worry about the timing. I truly appreciate your work, and thank you again for your response.
I'm running the latest released version, and I noticed something interesting. When calling base62.mudder('00', ''), the result I got was U - the same as when both a and b are empty strings base62.mudder('', '').
Regarding lexicographical sorting, I found that the JS sort function treats '0' < '00' < '000'. For example: ['000', '00', 'b', '', '0', 'a'].sort() yields: ['', '0', '00', '000', 'a', 'b'] So, based on this, '' < '0' < '00' < '000'.
This behavior doesn’t affect my use case since it’s easy to account for, but I do feel aligning with sort's handling of edge cases might be a better approach. That said, I’m unsure how feasible such a change would be.
What are your thoughts on this? If you think it’s worth pursuing but won’t have time in the coming weeks, I’d be happy to explore a potential solution with your guidance.
Thank you again for creating such a valuable library and for taking the time to engage with the community on this!
Hello,
First of all, thank you for creating and maintaining this library.
I've encountered an unexpected error when attempting to use the
base62.mudder()
function with the following arguments:base62.mudder('', '0')
.This behavior seems unexpected as I would assume that the function should be able to handle empty strings and 'zero' strings like '0', '00', '000'.
Please let me know if I can provide further details or help with debugging.
Thank you very much.
The text was updated successfully, but these errors were encountered: