sqids / sqids-javascript

Official JavaScript port of Sqids. Generate short unique IDs from numbers.
https://sqids.org/javascript
MIT License
659 stars 14 forks source link

fix(duplicate with alphabet): Replace Blob for compatibility with nod… #20

Closed MaxTheGlue closed 9 months ago

MaxTheGlue commented 9 months ago

…e environment

MaxTheGlue commented 9 months ago

This fix issue https://github.com/sqids/sqids-javascript/issues/19 In line 584 you have (new Blob([alphabet]).size !== alphabet.length) {... but Blob is not a native nodejs type, so in my nestjs project I have this error ReferenceError: Blob is not defined

miquelfire commented 9 months ago

You changed what that line did with this, actually. You changed it from detecting multibyte characters (when encoded to UTF-8) to detecting duplicates.

According to the package.json, this library only supports Node.js versions that have built-in support for Blob anyway.