mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Storages refactoring
This commit is contained in:
@@ -3,18 +3,19 @@ import * as format from 'string-template';
|
||||
import { TNodeWithBlockStatement } from '../../types/TNodeWithBlockStatement';
|
||||
import { TStatement } from '../../types/TStatement';
|
||||
|
||||
import { ICustomNodeWithData } from '../../interfaces/custom-nodes/ICustomNodeWithData';
|
||||
import { IOptions } from '../../interfaces/IOptions';
|
||||
import { IStorage } from '../../interfaces/IStorage';
|
||||
|
||||
import { AppendState } from '../../enums/AppendState';
|
||||
|
||||
import { StringArray } from '../../storages/StringArray';
|
||||
|
||||
import { StringArrayTemplate } from '../../templates/custom-nodes/string-array-nodes/string-array-node/StringArrayTemplate';
|
||||
|
||||
import { AbstractCustomNode } from '../AbstractCustomNode';
|
||||
import { NodeAppender } from '../../node/NodeAppender';
|
||||
import { StringArrayStorage } from '../../storages/StringArrayStorage';
|
||||
|
||||
export class StringArrayNode extends AbstractCustomNode {
|
||||
export class StringArrayNode extends AbstractCustomNode implements ICustomNodeWithData {
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
@@ -26,9 +27,9 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
protected appendState: AppendState = AppendState.AfterObfuscation;
|
||||
|
||||
/**
|
||||
* @type {StringArray}
|
||||
* @type {IStorage <string>}
|
||||
*/
|
||||
private stringArray: StringArray;
|
||||
private stringArray: IStorage <string>;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
@@ -47,7 +48,7 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
* @param options
|
||||
*/
|
||||
constructor (
|
||||
stringArray: StringArray,
|
||||
stringArray: IStorage <string>,
|
||||
stringArrayName: string,
|
||||
stringArrayRotateValue: number = 0,
|
||||
options: IOptions
|
||||
@@ -81,16 +82,9 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
* @returns {IStorage <string>}
|
||||
*/
|
||||
public getNodeIdentifier (): string {
|
||||
return this.stringArrayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {StringArray}
|
||||
*/
|
||||
public getNodeData (): StringArray {
|
||||
public getNodeData (): IStorage <string> {
|
||||
return this.stringArray;
|
||||
}
|
||||
|
||||
@@ -98,15 +92,8 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
* @returns {TStatement[]}
|
||||
*/
|
||||
public getNode (): TStatement[] {
|
||||
this.stringArray.rotateArray(this.stringArrayRotateValue);
|
||||
(<StringArrayStorage>this.stringArray).rotateArray(this.stringArrayRotateValue);
|
||||
|
||||
return super.getNode();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
*/
|
||||
public updateNodeData (data: string): void {
|
||||
this.stringArray.addToArray(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user