mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Substitute the index generator into one function
This commit is contained in:
+4
-2
@@ -78,13 +78,15 @@ export class Utils {
|
||||
public static generateIden (): string {
|
||||
let validIden: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_';
|
||||
let ret: string = '';
|
||||
|
||||
const idenIdx: (() => number) = () => Math.floor(Math.random() * validIden.length) % validIden.length;
|
||||
|
||||
ret += validIden[Math.floor(Math.random() * validIden.length) % validIden.length];
|
||||
ret += validIden[idenIdx()];
|
||||
validIden += '0123456789';
|
||||
|
||||
const len: number = Math.floor((Math.random() * 10) + 3);
|
||||
for (let i: number = 0; i < len; i++) {
|
||||
ret += validIden[Math.floor(Math.random() * validIden.length) % validIden.length];
|
||||
ret += validIden[idenIdx()];
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user