add support for builtin "bigint" and other libraries for handling big numbers #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds handling of the Javascript built-in datatyp "BigInt" (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) and supports some other Javascript libraries to work with big numbers (list added in the README).
The other libraries are optional and recognition must be enabled with new option parameter to the jsonViewer() method. The current default handling is not changed.
The reason behind this patch is that javascripts "Number" type only supports a subset of the number range of other languages, its roughy equivalent to other "float" data types. All numbers from "long" or "double" like data types cannot be displayed with it. As the JSON spec defines no ranges for numbers big values can only be handled with special libraries in Javascript without changing the values or loosing precision. Current version of the json-viewer does not display such numbers but all fields of the objects needed to cunstruct these numbers, therefore displaying wrong informations for such special cases (examples inside the README)
Adding this PR would really help us in our own project (Redis-Commander) to display values stored inside a Redis DB correctly..
Thanks,
Stefan Seide