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

fix conditional parse logic for exponential numbers #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tveal
Copy link

@tveal tveal commented Mar 27, 2023

The parse conditional logic doesn't properly account for a stringified array with a single E in it; The logic needs to more accurately exclude exponential-like numbers-as-string and allow everything else. This change uses native JavaScript logic for detecting numbers instead of manually splitting a string on E. The exp-number check also acts as a minimal exclude allowing everything else to be parsed without explicit specification. Unit tests added to cover the known cases.


expect(parsed).to.deep.equal(original);
});
it('should NOT parse stringified exponential number', () => {
Copy link
Member

@jgilbert01 jgilbert01 Mar 28, 2023

Choose a reason for hiding this comment

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

  • it should NOT parse a non-stringified string that looks like an exponential number
  • it is a subtle difference, but i'm concerned too many things will fall into this condition

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.

2 participants