-
Notifications
You must be signed in to change notification settings - Fork 10
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
Common util encode should take an object and stringify #904
Common util encode should take an object and stringify #904
Conversation
@josephjclark please review this for me. |
Thank you @PiusKariuki ! I'll look at this tomorrow and hopefully roll it into the same releases as your other fixes (we had a problem with released today which blocked me from getting to release your stuff - should be all OK tomorrow!) |
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.
Thanks @PiusKariuki! I've got a few suggestions here - please take a look.
When you're done, can you run pnpm changeset
and generate a patch
change note? Thanks!
…a string empty objects included
…-serializable object
…ed before encoding. This means no errors thrown when numbers, booleans and regex expressions are passed
…an options object that allows users to explicitly disable the JSON parse step
…ode and decode functions i.e. the `parseJson` parameter
@josephjclark does this look okay now? |
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.
Thanks @PiusKariuki !
Summary
Adds functionality to encode and decode JSON objects in the encode and decode util functions
Fixes #794
Details
Added a conditional in the
encode
util to check for objects and stringify them first before encoding them.Added functionality to
decode
that handles JSON objects and parses them to standard JavaScript objects.AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Review Checklist
Before merging, the reviewer should check the following items:
dev only changes don't need a changeset.