i created a minimal example:
1234567 generates 56thj, but if i choose to block thj i expect to have another id and this does not happen
i tracked the problem to be in function isBlockedId at the first comparison:
if i change
if (lowercaseId.length <= 3 || word.length <= 3) {
to
if (lowercaseId.length === word.length) {
it works as expected, because it will go on the other conditions
example
const sqids = new Sqids({
blocklist: new Set(['thj'])
});
const id = sqids.encode([1234567]); // 56thj
console.log(id);
i created a minimal example: 1234567 generates 56thj, but if i choose to block thj i expect to have another id and this does not happen i tracked the problem to be in function isBlockedId at the first comparison: if i change
to
it works as expected, because it will go on the other conditions
example