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

'&&' and '||' priority #110

Open
VincentWuShiChao opened this issue Jun 3, 2021 · 1 comment
Open

'&&' and '||' priority #110

VincentWuShiChao opened this issue Jun 3, 2021 · 1 comment

Comments

@VincentWuShiChao
Copy link

The priority of the current module is && and | | is the same,The result of ' 'true && true || false && false'' is false.But in JavaScript, '&&' than '| |' priority,so The result of ' 'true && true || false && false'' is true.

My solution so far is to rewrite the priorities。The following:
jexl.addBinaryOp('&&', 11, (left, right) => {
return left && right;
});

@TomFrost
Copy link
Owner

Sorry for the late response to this -- this is a great observation. While Jexl's goal isn't to mirror Javascript, I think this is a great move for predictability. It is a breaking change, though, so this will come in the next major version release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants