-
Notifications
You must be signed in to change notification settings - Fork 15
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
🐛 💥 Correct toJSON
to match the specifications of JSON.stringify
#242
Conversation
`toJSON` returns a JSON value that can be specified to `JSON.stringify`. It is NOT a JSON string that can be specified to `JSON.parse`. This is a breaking change for code that depended on previous incorrect behavior. Previous (incorrect) behaviour: ```ts await useExprString(denops, async (denops) => { await denops.cmd('echo type(value)', { value: { toJSON: () => "123" } }); // output: 0 (equals `v:t_number`) }); ``` New (correct) behaviour: ```ts await useExprString(denops, async (denops) => { await denops.cmd('echo type(value)', { value: { toJSON: () => "123" } }); // output: 1 (equals `v:t_string`) }); ```
WalkthroughThe updates involve modifying the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #242 +/- ##
=======================================
Coverage 82.52% 82.52%
=======================================
Files 57 57
Lines 2964 2964
Branches 262 262
=======================================
Hits 2446 2446
Misses 516 516
Partials 2 2 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- helper/expr_string.ts (2 hunks)
- helper/expr_string_test.ts (7 hunks)
Files not reviewed due to errors (1)
- helper/expr_string_test.ts (no review received)
Additional comments not posted (2)
helper/expr_string.ts (2)
46-50
: Change inJsonable
interface aligns with JSON specification.
132-132
: Simplification invimStringify
function by removingJSON.parse
is correct.
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.
LGTM
toJSON
returns a JSON value that can be specified toJSON.stringify
.It is NOT a JSON string that can be specified to
JSON.parse
.This is a breaking change for code that depended on previous incorrect behavior.
Previous (incorrect) behaviour:
New (correct) behaviour:
Summary by CodeRabbit
toJSON
method to enhance flexibility in handling various data types.toJSON
method behavior.