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

BigInt #51

Open
clarghi opened this issue Oct 30, 2023 · 0 comments
Open

BigInt #51

clarghi opened this issue Oct 30, 2023 · 0 comments

Comments

@clarghi
Copy link

clarghi commented Oct 30, 2023

Hi,
I use the version 2.5.0 (I'll update, but I don't now when actually).

This plugin fails if more than 32-33 (I don't remember exactly) items flaggables, because the javascript bitwise OR truncate:
see documentation.

I have created a flaggable enum using the BigInt object, and the plugin crash only in one method:

if(!(e.value!==0&&!(e.value&e.value-1))) { return false; }

Fails because cannot use the minus operator between Number and BigInt.

I have tested using typeof and resolved. When I will update to latest version, if this problem will be present yet I'll create a PL.

Solution:

if((typeof e.value==="number")&&(!(e.value !== 0 && !(e.value & e.value - 1)))) { return false; } else if((typeof e.value==="bigint")&&(!(e.value!==0&&!(e.value&e.value-BigInt(1))))) { return false; }

B.r.
Cristiano Larghi

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