mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Updated TSLint rules
This commit is contained in:
@@ -79,7 +79,7 @@ export class NodeAppender {
|
||||
const firstCall: IStackTraceData = blockScopeTraceData[index];
|
||||
|
||||
if (deep <= 0) {
|
||||
throw new Error(`Invalid \`deep\` argument value. Value should be bigger then 0.`);
|
||||
throw new Error('Invalid `deep` argument value. Value should be bigger then 0.');
|
||||
}
|
||||
|
||||
if (deep > 1 && firstCall.stackTrace.length) {
|
||||
|
||||
+19
-17
@@ -160,27 +160,29 @@ export class NodeUtils {
|
||||
|
||||
const copy: TObject = {};
|
||||
|
||||
for (const property in node) {
|
||||
if (!node.hasOwnProperty(property) || property === 'parentNode') {
|
||||
continue;
|
||||
}
|
||||
Object
|
||||
.keys(node)
|
||||
.forEach((property: string) => {
|
||||
if (property === 'parentNode') {
|
||||
return;
|
||||
}
|
||||
|
||||
const value: T[keyof T] = node[property];
|
||||
const value: T[keyof T] = node[<keyof T>property];
|
||||
|
||||
let clonedValue: T[keyof T] | T[keyof T][] | null;
|
||||
let clonedValue: T[keyof T] | T[keyof T][] | 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user