Skip to content

fix conditional parse logic for exponential numbers#15

Open
tveal wants to merge 2 commits into
DanteInc:masterfrom
tveal:fix-conditional-parsing
Open

fix conditional parse logic for exponential numbers#15
tveal wants to merge 2 commits into
DanteInc:masterfrom
tveal:fix-conditional-parsing

Conversation

@tveal

@tveal tveal commented Mar 27, 2023

Copy link
Copy Markdown

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.

Comment thread test/unit/utils.test.js

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

@jgilbert01 jgilbert01 Mar 28, 2023

Copy link
Copy Markdown
Member

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