fix: ensure length and count are > 0

This commit is contained in:
ShareVB 2024-09-22 19:03:02 +02:00
parent bda56ac263
commit aba466ac89
2 changed files with 6 additions and 4 deletions

View file

@ -24,5 +24,6 @@ export function createToken({
+ (withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '')
)).split('').filter(c => !(deniedChars?.includes(c))).join('');
return shuffleString(allAlphabet.repeat(length)).substring(0, length);
const len = length < 1 ? 1 : length;
return shuffleString(allAlphabet.repeat(len)).substring(0, len);
}