mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Remove few any types
This commit is contained in:
+17
-19
@@ -136,29 +136,27 @@ export class NodeUtils {
|
||||
|
||||
const copy: TObject = {};
|
||||
|
||||
Object
|
||||
.keys(node)
|
||||
.forEach((property: string): void => {
|
||||
if (property === 'parentNode') {
|
||||
return;
|
||||
}
|
||||
for (const property in node) {
|
||||
if (!node.hasOwnProperty(property) || property === 'parentNode') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const value: any = (<TObject>node)[property];
|
||||
const value: any = node[property];
|
||||
|
||||
let clonedValue: any | null;
|
||||
let clonedValue: any | null;
|
||||
|
||||
if (value === null || value instanceof RegExp) {
|
||||
clonedValue = value;
|
||||
} else if (Array.isArray(value)) {
|
||||
clonedValue = value.map(NodeUtils.cloneRecursive);
|
||||
} else if (typeof value === 'object') {
|
||||
clonedValue = NodeUtils.cloneRecursive(value);
|
||||
} else {
|
||||
clonedValue = value;
|
||||
}
|
||||
if (value === null || value instanceof RegExp) {
|
||||
clonedValue = value;
|
||||
} else if (Array.isArray(value)) {
|
||||
clonedValue = value.map(NodeUtils.cloneRecursive);
|
||||
} else if (typeof value === 'object') {
|
||||
clonedValue = NodeUtils.cloneRecursive(value);
|
||||
} else {
|
||||
clonedValue = value;
|
||||
}
|
||||
|
||||
copy[property] = clonedValue;
|
||||
});
|
||||
copy[property] = clonedValue;
|
||||
}
|
||||
|
||||
return <T>copy;
|
||||
}
|
||||
|
||||
+2
-2
@@ -434,10 +434,10 @@ export class Nodes {
|
||||
|
||||
/**
|
||||
* @param {Identifier} id
|
||||
* @param {any} init
|
||||
* @param {Expression | null} init
|
||||
* @returns {VariableDeclarator}
|
||||
*/
|
||||
public static getVariableDeclaratorNode (id: ESTree.Identifier, init: any): ESTree.VariableDeclarator {
|
||||
public static getVariableDeclaratorNode (id: ESTree.Identifier, init: ESTree.Expression | null): ESTree.VariableDeclarator {
|
||||
return {
|
||||
type: NodeType.VariableDeclarator,
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user