-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: Enhance VariableEditor to support BigNumber type handling #55
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
case 'bigNumber': | ||
string_value = value.toString() | ||
break |
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.
why not treat it as string at this level?
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.
The separate case for bigNumber is intentional - it helps distinguish between bigNumber and regular string types. This distinction is particularly useful when we need different display formats, allowing us to maintain consistent handling of bigNumber values while preserving the flexibility to format them either as bigNumber or strings based on the configuration, following the same pattern as the existing code.
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.
Added some comments; Additionally, you should to add it into the dev-server too
https://github.com/microlinkhq/react-json-view/blob/main/dev-server/src/index.js#L199
bigNumber
property toReactJsonView
andVariableEditor
components.JsonBigNumber
component for rendering BigNumber values.parseInput
andstringifyVariable
functions to handle BigNumber parsing and stringification.toType
utility function to recognize BigNumber instances.bigNumber
property and its usage.This update improves the precision handling of numbers in the application.