mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-22 07:46:15 -04:00
fix: error in denied chars logic
This commit is contained in:
parent
8881f440ef
commit
bda56ac263
1 changed files with 6 additions and 6 deletions
|
@ -17,12 +17,12 @@ export function createToken({
|
||||||
length?: number
|
length?: number
|
||||||
alphabet?: string
|
alphabet?: string
|
||||||
}) {
|
}) {
|
||||||
const allAlphabet = alphabet ?? [
|
const allAlphabet = (alphabet ?? (
|
||||||
withUppercase ? 'ABCDEFGHIJKLMOPQRSTUVWXYZ' : '',
|
(withUppercase ? 'ABCDEFGHIJKLMOPQRSTUVWXYZ' : '')
|
||||||
withLowercase ? 'abcdefghijklmopqrstuvwxyz' : '',
|
+ (withLowercase ? 'abcdefghijklmopqrstuvwxyz' : '')
|
||||||
withNumbers ? '0123456789' : '',
|
+ (withNumbers ? '0123456789' : '')
|
||||||
withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '',
|
+ (withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '')
|
||||||
].filter(c => !(deniedChars?.includes(c))).join(''); ;
|
)).split('').filter(c => !(deniedChars?.includes(c))).join('');
|
||||||
|
|
||||||
return shuffleString(allAlphabet.repeat(length)).substring(0, length);
|
return shuffleString(allAlphabet.repeat(length)).substring(0, length);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue