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

Add default read offsets for Node Buffer compatibility #99

Merged
merged 3 commits into from
Feb 9, 2021
Merged

Add default read offsets for Node Buffer compatibility #99

merged 3 commits into from
Feb 9, 2021

Conversation

benallfree
Copy link
Contributor

This PR adds an optional offset to the readXX methods to create compatibility with the Node Buffer API https://nodejs.org/api/buffer.html#buffer_buf_readbigint64be_offset

This PR adds an optional offset to the `readXX` methods to create compatibility with the Node Buffer API https://nodejs.org/api/buffer.html#buffer_buf_readbigint64be_offset
Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

could you please add a unit test? Thanks!

@benallfree
Copy link
Contributor Author

@mcollina Hey ok I added some tests. Please check out how I handled the floats, I kind of feel like this is a better test anyway. Rather than testing against hard-coded hex values, we can test equivalence with the output value of a real Node Buffer for the same input. If you agree that this is a better test, I'm happy to update the rest of the read* tests to match. Please let me know! :)

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina requested a review from rvagg February 8, 2021 09:23
Copy link
Owner

@rvagg rvagg left a comment

Choose a reason for hiding this comment

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

sure, I don't think this is a breaking change in any way, so just a semver-minor?

@benallfree
Copy link
Contributor Author

benallfree commented Feb 9, 2021

@rvagg agree, just minor or even patch

Did you want me to update the readXX tests to test against a native Buffer output rather than hard-coded values?

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.

3 participants