Skip to content

Conversation

@mikekono
Copy link
Contributor

No description provided.

@mikekono mikekono requested a review from Copilot October 16, 2025 14:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Improves performance in JSON parsing logic by utilizing modern browser features and optimizing regular expression patterns for handling BigInt values in JSON serialization/deserialization.

  • Updates JSON parsing logic to use native JSON.rawJSON when available (Node 20.12+, Chrome 114+)
  • Replaces complex regex patterns with more efficient string/number matching
  • Adds noise value handling to prevent conflicts with the custom BigInt format

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/core/json.ts Refactored JSON serialization/parsing logic with performance optimizations and modern API support
jest.config.mjs Added transform configurations for Jest test environments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +39 to +43
if (Array.isArray(replacer) && replacer.includes(key)) {
return val;
}

return val;
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When replacer is an array, the logic is inverted. According to JSON.stringify spec, when replacer is an array, only properties with keys included in the array should be serialized. Currently, it returns the value when the key is included but also returns the value unconditionally at the end, making the array check ineffective.

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +76
if (Array.isArray(replacer) && replacer.includes(key)) {
return val;
}

return val;
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When replacer is an array, the logic is inverted. According to JSON.stringify spec, when replacer is an array, only properties with keys included in the array should be serialized. Currently, it returns the value when the key is included but also returns the value unconditionally at the end, making the array check ineffective.

Copilot uses AI. Check for mistakes.
@mikekono mikekono closed this Oct 16, 2025
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