buffer icon indicating copy to clipboard operation
buffer copied to clipboard

entire library won't work if BigInt syntax is unsupported

Open cyan-2048 opened this issue 1 year ago • 0 comments
trafficstars

this library seems to check for BigInt support, however a simple typeof BigInt won't suffice

using the BigInt syntax (ex. 1n, 345n) would cause a SyntaxError: identifier starts immediately after numeric literal on browsers that don't support it, so the entire script file won't work if this library is present

and no, SyntaxErrors won't get caught even with try-catch, the entire script will just refuse to run

suggestion: create a different import for no-bigint import("buffer/no-bigint") and replace all the bigint related methods with the bigint unsupported error function

for the default import("buffer") it should import("buffer/no-bigint") and set the bigint related methods

cyan-2048 avatar May 12 '24 20:05 cyan-2048