Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

encoder: Encode instances of Number as numbers, not maps #271

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

Open
FlorianDenis wants to merge 2 commits into msgpack:main
base: main
Choose a base branch
Loading
from FlorianDenis:main

Conversation

Copy link

@FlorianDenis FlorianDenis commented Mar 7, 2025
edited
Loading

Make sure instances of Number as encoded as a number instead of a map.
I am encountering this issue in my current project, I believe this is a more sensible default behavior

All tests pass.

Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

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

Project coverage is 97.19%. Comparing base (59057ee) to head (b450e25).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/Encoder.ts 50.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@ Coverage Diff @@
## main #271 +/- ##
==========================================
- Coverage 97.28% 97.19% -0.09% 
==========================================
 Files 17 17 
 Lines 1140 1142 +2 
 Branches 253 254 +1 
==========================================
+ Hits 1109 1110 +1 
- Misses 31 32 +1 

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

gfx commented Mar 8, 2025

Why do you use the Number wrapper object? There's no reason to use it and it seems just a bug, in your project.

Copy link
Author

I am not going to go too much into the details of my project because this is not the place, but it turns out that I have a need for representing a integer using an object instance rather than a primitive type, a need which Number was built into the language to fulfill. This is a deliberate choice, not a bug.

My goal with this PR is merely to point out that Number does exist today as a core part of the language (has since ES1, really), and so the question this poses here is:

  • Do we consider the MessagePack representation of it should be a map
  • Or do we consider it should be a int/float?

Copy link
Author

@gfx Any thoughts on the above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /