Skip to content

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