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

$pad Function With Non-Integer Width Results in Uncaught RangeError #717

Open
melalawi opened this issue Oct 2, 2024 · 0 comments
Open

Comments

@melalawi
Copy link

melalawi commented Oct 2, 2024

Hello,

Attempting to invoke $pad with a decimal value length like 2.1 results in RangeError: invalid array length being thrown. This is due to the padding array being instantiated with a non-integer length which is not allowed. This exception is not caught anywhere in the call stack.

We should either floor width before using it to calculate padLength or throw a JSONata exception.

Repro: $pad("s", 2.1, " ")

@melalawi melalawi changed the title $pad Function With Decimal-Value Width Results in Uncaught RangeError $pad Function With Non-Integer Width Results in Uncaught RangeError Oct 2, 2024
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

No branches or pull requests

1 participant