Skip to content

Commit bda56ac

Browse files
committed
fix: error in denied chars logic
1 parent 8881f44 commit bda56ac

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/tools/token-generator/token-generator.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export function createToken({
1717
length?: number
1818
alphabet?: string
1919
}) {
20-
const allAlphabet = alphabet ?? [
21-
withUppercase ? 'ABCDEFGHIJKLMOPQRSTUVWXYZ' : '',
22-
withLowercase ? 'abcdefghijklmopqrstuvwxyz' : '',
23-
withNumbers ? '0123456789' : '',
24-
withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '',
25-
].filter(c => !(deniedChars?.includes(c))).join(''); ;
20+
const allAlphabet = (alphabet ?? (
21+
(withUppercase ? 'ABCDEFGHIJKLMOPQRSTUVWXYZ' : '')
22+
+ (withLowercase ? 'abcdefghijklmopqrstuvwxyz' : '')
23+
+ (withNumbers ? '0123456789' : '')
24+
+ (withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '')
25+
)).split('').filter(c => !(deniedChars?.includes(c))).join('');
2626

2727
return shuffleString(allAlphabet.repeat(length)).substring(0, length);
2828
}

0 commit comments

Comments
 (0)