Skip to content

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 gutbrod.markus@googlemail.com

@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