Browse Source

Added constants with alphabet and numbers strings

sanex3339 4 years ago
parent
commit
e625757ae0

File diff suppressed because it is too large
+ 0 - 0
dist/index.browser.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.cli.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.js


+ 1 - 1
package.json

@@ -77,7 +77,7 @@
     "pre-commit": "1.2.2",
     "rimraf": "3.0.2",
     "sinon": "9.0.2",
-    "threads": "1.6.2",
+    "threads": "1.6.3",
     "ts-loader": "7.0.5",
     "ts-node": "8.10.2",
     "typescript": "3.9.5",

+ 1 - 0
src/constants/AlphabetString.ts

@@ -0,0 +1 @@
+export const alphabetString: string = 'abcdefghijklmnopqrstuvwxyz';

+ 3 - 0
src/constants/AlphabetStringUppercase.ts

@@ -0,0 +1,3 @@
+import { alphabetString } from './AlphabetString';
+
+export const alphabetStringUppercase: string = alphabetString.toUpperCase();

+ 1 - 0
src/constants/NumbersString.ts

@@ -0,0 +1 @@
+export const numbersString: string = '0123456789';

+ 5 - 1
src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts

@@ -1,3 +1,7 @@
+import { alphabetStringUppercase } from '../../../../constants/AlphabetStringUppercase';
+import { alphabetString } from '../../../../constants/AlphabetString';
+import { numbersString } from '../../../../constants/NumbersString';
+
 /**
  * @returns {string}
  */
@@ -6,7 +10,7 @@ export function AtobTemplate (): string {
         (function () {
             {globalVariableTemplate}
             
-            const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+            const chars = '${alphabetStringUppercase}${alphabetString}${numbersString}+/=';
 
             that.atob || (
                 that.atob = function(input) {

+ 5 - 1
src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts

@@ -6,6 +6,10 @@ import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
+import { numbersString } from '../../constants/NumbersString';
+import { alphabetString } from '../../constants/AlphabetString';
+import { alphabetStringUppercase } from '../../constants/AlphabetStringUppercase';
+
 import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator';
 import { NodeLexicalScopeUtils } from '../../node/NodeLexicalScopeUtils';
 
@@ -24,7 +28,7 @@ export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGene
     /**
      * @type {string[]}
      */
-    private static readonly nameSequence: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
+    private static readonly nameSequence: string[] = `${numbersString}${alphabetString}${alphabetStringUppercase}`.split('');
 
     /**
      * Reserved JS words with length of 2-4 symbols that can be possible generated with this replacer

+ 5 - 1
src/utils/CryptUtils.ts

@@ -4,6 +4,10 @@ import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 import { ICryptUtils } from '../interfaces/utils/ICryptUtils';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 
+import { alphabetStringUppercase } from '../constants/AlphabetStringUppercase';
+import { alphabetString } from '../constants/AlphabetString';
+import { numbersString } from '../constants/NumbersString';
+
 import { RandomGenerator } from './RandomGenerator';
 import { Utils } from './Utils';
 
@@ -28,7 +32,7 @@ export class CryptUtils implements ICryptUtils {
      * @returns {string}
      */
     public btoa (string: string): string {
-        const chars: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
+        const chars: string = `${alphabetStringUppercase}${alphabetString}${numbersString}+/=`;
 
         let output: string = '';
 

+ 4 - 1
src/utils/RandomGenerator.ts

@@ -11,12 +11,15 @@ import { ISourceCode } from '../interfaces/source-code/ISourceCode';
 
 import { initializable } from '../decorators/Initializable';
 
+import { alphabetString } from '../constants/AlphabetString';
+import { alphabetStringUppercase } from '../constants/AlphabetStringUppercase';
+
 @injectable()
 export class RandomGenerator implements IRandomGenerator, IInitializable {
     /**
      * @type {string}
      */
-    public static readonly randomGeneratorPool: string = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+    public static readonly randomGeneratorPool: string = `${alphabetString}${alphabetStringUppercase}`;
 
     /**
      * @type {Chance.Chance}

+ 4 - 4
yarn.lock

@@ -5067,10 +5067,10 @@ text-table@^0.2.0:
   resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
   integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
 
[email protected].2:
-  version "1.6.2"
-  resolved "https://registry.yarnpkg.com/threads/-/threads-1.6.2.tgz#ef91053910a084aa99a1f460cb9978f577596d6f"
-  integrity sha512-SB3yJ3WcwGWYYsUg1Wg9IhQ88BUq1JwZlQsaBgmolSqet5wiBaFhg8cyfHFbHGRElZ/sl4bahrrSEz3Odmr1Vg==
[email protected].3:
+  version "1.6.3"
+  resolved "https://registry.yarnpkg.com/threads/-/threads-1.6.3.tgz#89324a93509403c90a169344023151ae1fe4986b"
+  integrity sha512-tKwFIWRgfAT85KGkrpDt2jWPO8IVH0sLNfB/pXad/VW9eUIY2Zlz+QyeizypXhPHv9IHfqRzvk2t3mPw+imhWw==
   dependencies:
     callsites "^3.1.0"
     debug "^4.1.1"

Some files were not shown because too many files changed in this diff