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

feat(NODE-6087): add Int32.fromString method #670

Merged
merged 10 commits into from
Apr 17, 2024

Conversation

aditi-khare-mongoDB
Copy link
Contributor

@aditi-khare-mongoDB aditi-khare-mongoDB commented Apr 16, 2024

Description

Add static Int32.fromString() method.

What is changing?

Is there new documentation needed for these changes?

Yes, there are new API docs.

What is the motivation for this change?

NODE-3660 user ticket, our validation in the Int32 is lacking. In V7, we will add Int32.fromString(value) validation call into the Int32 constructor's string case.

Release Highlight

Add static Int32.fromString method

This method attempts to create an Int32 type from string, and will throw a BSONError on any string input that is not representable as an Int32.
Notably, this method will also throw on the following string formats:

  • Strings in non-decimal formats (exponent notation, binary, hex, or octal digits)
  • Strings with non-numeric and non-leading sign characters (ex: '2.0', '24,000')
  • Strings with leading and/or trailing whitespace

Strings with leading zeros, however, are allowed

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@aditi-khare-mongoDB aditi-khare-mongoDB marked this pull request as ready for review April 16, 2024 20:51
@baileympearson baileympearson self-assigned this Apr 17, 2024
src/int_32.ts Outdated Show resolved Hide resolved
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants