adrai / adrai/enum

BigInt

Đang mở
#51 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
201
Fork
30
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR).

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.