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

Binary/Octal/Hexadecimal numbers #573

Merged
merged 1 commit into from
May 10, 2022
Merged

Conversation

bigbug
Copy link
Contributor

@bigbug bigbug commented May 3, 2022

In the current implementation the $number() function does not allow the conversion of binary, octal or hexadecimal numbers. This PR changes that.

A regex is used to find such numbers with a given prefix (0x for hexadecimal, 0o for octal, 0b for binary). If a valid Number is found, JavaScript's built-in function Number() is used to convert the string to a number.

Tests and Documentation have been adapted.

Signed-off-by: Markus Gutbrod [email protected]

@mattbaileyuk
Copy link
Member

Closing and reopening to see if that triggers Travis

@mattbaileyuk mattbaileyuk reopened this May 9, 2022
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 7b4c810 on bigbug:master into b97c9d7 on jsonata-js:master.

@mattbaileyuk
Copy link
Member

Looks good, thanks for the contribution @bigbug 👍

@mattbaileyuk mattbaileyuk merged commit 3cea53f into jsonata-js:master May 10, 2022
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