Skip to content

Conversation

@reharik
Copy link

@reharik reharik commented Sep 10, 2025

This PR is contingent on a PR that is pending against co-body. While that PR is being processed this one is referencing my fork of that library.
This PR creates a new property on the option object called "customReviver" that accepts a function that would then be passed to co-body/parser when parsing json. Co-body then passes this function to JSON.parse as the second parameter in the parse signature.
The use case for this that if you would like to customize the way JSON.parse parses the json your api receives you can now do so by passing this function.
I have also provided a number of tests that prove the feature to work and not break other features.

Checklist

  • [ x] I have ensured my pull request is not behind the main or master branch of the original repository.
  • [ x] I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • [x ] I have written a commit message that passes commitlint linting.
  • [x ] I have ensured that my code changes pass linting tests.
  • [ x] I have ensured that my code changes pass unit tests.
  • [x ] I have described my pull request and the reasons for code changes along with context if necessary.

…then be passed to co-body as a reviver function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant