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

JsValue::to_json fix integer property keys #4011

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

Nikita-str
Copy link
Contributor

This Pull Request fixes #3923

Copy link

codecov bot commented Sep 28, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 52.79%. Comparing base (6ddc2b4) to head (b0800c4).
Report is 268 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/value/conversions/serde_json.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4011      +/-   ##
==========================================
+ Coverage   47.24%   52.79%   +5.54%     
==========================================
  Files         476      480       +4     
  Lines       46892    46684     -208     
==========================================
+ Hits        22154    24645    +2491     
+ Misses      24738    22039    -2699     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 147 to 151
.and_then(|x| x.value().cloned())
{
Some(val) => val.to_json(context),
None => Ok(Value::Null),
};
Copy link
Contributor

@CrazyboyQCD CrazyboyQCD Sep 29, 2024

Choose a reason for hiding this comment

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

Maybe a bit off, but we could avoid the clone here with extra map:

     .and_then(|x| x.value().map(|v| v.to_json(context)))
{
    Some(val) => val?,
    None => Value::Null,
};

And similar thing can be done here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the worst case it's still just cloning of a smart pointer so I don't think that it has much overhead costs, but ok, done

Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

Thank you for the fix!

@raskad raskad requested a review from a team October 9, 2024 17:41
@HalidOdat HalidOdat added this pull request to the merge queue Oct 9, 2024
Merged via the queue into boa-dev:main with commit 67f4884 Oct 9, 2024
13 checks passed
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.

JsValue to_json removes integer keys from objects rather than stringify them.
4 participants