Skip to content
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

Support alwaysParseAsBig with storeAsString #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ronmrdechai
Copy link

When alwaysParseAsBig is set to true, and json-bigint encounters a safe number, it doesn't check whether storeAsString is true as well. This PR adds a check for storeAsString, similar to the ternary check when the encountered number is not safe.

I am using json-bigint to parse responses from an API server which passes down raw IDs via an HTTP API. No arithmetic is performed on these IDs, and they're passed back to the server on subsequent HTTP calls. This means storing numbers in the API server's responses as strings is very convenient, and just works when interoping with Node JS's native HTTP module, or with the request module.

A unit tests was also added to ensure this works correctly.

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