anobis
Version:
JavaScript obfuscator
53 lines (43 loc) • 1.52 kB
text/typescript
import { injectable, inject, postConstruct } from 'inversify';
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
import { IArrayUtils } from '../../interfaces/utils/IArrayUtils';
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
import { ArrayStorage } from '../ArrayStorage';
import { RandomGenerator } from '../../utils/RandomGenerator';
()
export class StringArrayStorage extends ArrayStorage <string> {
/**
* @type {IArrayUtils}
*/
private readonly arrayUtils: IArrayUtils;
/**
* @param {IArrayUtils} arrayUtils
* @param {IRandomGenerator} randomGenerator
*/
constructor (
(ServiceIdentifiers.IArrayUtils) arrayUtils: IArrayUtils,
(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator
) {
super(randomGenerator);
this.arrayUtils = arrayUtils;
}
()
public initialize (): void {
super.initialize();
this.storageId = this.randomGenerator.getRandomString(4, RandomGenerator.randomGeneratorPoolHexadecimal);
}
/**
* @param {number} rotationValue
*/
public rotateArray (rotationValue: number): void {
this.storage = this.arrayUtils.arrayRotate(this.storage, rotationValue);
}
/**
* @returns {string}
*/
public toString (): string {
return this.storage.map((value: string) => {
return `'${value}'`;
}).toString();
}
}