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

feat: Enhance VariableEditor to support BigNumber type handling #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Suntgr
Copy link

@Suntgr Suntgr commented Jan 22, 2025

  • Added bigNumber property to ReactJsonView and VariableEditor components.
  • Introduced JsonBigNumber component for rendering BigNumber values.
  • Updated parseInput and stringifyVariable functions to handle BigNumber parsing and stringification.
  • Modified toType utility function to recognize BigNumber instances.
  • Updated README.md to document the new bigNumber property and its usage.

This update improves the precision handling of numbers in the application.

Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-json-view ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 9:53am

Comment on lines +17 to +19
case 'bigNumber':
string_value = value.toString()
break
Copy link
Member

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?

Copy link
Author

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.

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@Kikobeats Kikobeats left a 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

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.

2 participants