-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(encoding/unstable): decodeBase32Hex()
and encodeBase32Hex()
#4931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. @std/encoding
is about to be in its release candidate phase, so it'll be in a change freeze (except for documentation improvements and bug fixes). This change will be merged once that's complete.
decodeBase32Hex()
and encodeBase32Hex()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add the new module to the exports in encoding/deno.json
?
I actually already did, I didn't add the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4931 +/- ##
==========================================
- Coverage 96.37% 95.88% -0.49%
==========================================
Files 465 475 +10
Lines 37506 38464 +958
Branches 5527 5553 +26
==========================================
+ Hits 36147 36883 +736
- Misses 1317 1539 +222
Partials 42 42 ☔ View full report in Codecov by Sentry. |
The only error left seems to be that you forgot to update the assertEquals in the jsdoc examples when you copied it over. |
Good catch, this has been fixed, thanks. |
Hey there. Sorry for the delay. On second thought, with the only difference being the alphabet used, I think we should add an interface Base32Options {
/**
* Base32 format to use.
*
* @default {"standard"}
*/
format?: "standard" | "hex";
} What do y'all think? |
Actually, we can have separate functions but have them all in the existing |
decodeBase32Hex()
and encodeBase32Hex()
decodeBase32Hex()
and encodeBase32Hex()
I think the best way to do it would be the same way base64 and base64url are done. |
base32 and base32Hex functions have almost complete overlap - there's no benefit to separating them. Arguably, the same could be said for base32Url, but that's a separate conversation. |
I don't have an opinion one way or the other on how it should be done, but I think consistency is best. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chatted with Yoshiya, and on second thought, we're happy to proceed with this format. I also made a couple of tweaks. Now, LGTM! Thank you very much.
As requested in #4917 I have added base32hex encoding and decoding.
I first created new tests from the base32 test cases and using this tool:
https://tomeko.net/online_tools/base32hex.php?lang=en
Once those tests passed, I extracted the common base32 and base32 hex into a
_utils
module with a new parameter for a lookup table.This is my first time contributing to an open source project and using deno. I am having trouble running the
task ok
. It is failing on my documentation examples with the error below. I think I'm missing a step though, because it's executing with the published module from jsr rather than the local version. This means it makes sense that my module is not there, because it won't be in version 0.224.3. If there's any step I'm missing here I'd really appreciate any feedback.Closes #4931