reduce duplication in secureRndstr

This commit is contained in:
Johann150 2022-12-15 20:46:17 +01:00
parent 5f83383ab8
commit af43df15ca
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -1,7 +1,7 @@
import * as crypto from 'node:crypto'; import * as crypto from 'node:crypto';
const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'; const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz';
const LU_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; const LU_CHARS = L_CHARS + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
export function secureRndstrCustom(length = 32, chars: string): string { export function secureRndstrCustom(length = 32, chars: string): string {
const chars_len = chars.length; const chars_len = chars.length;