UNPKG

@nodesecure/js-x-ray

Version:
33 lines 955 B
import { match } from "ts-pattern"; // Import Internal Dependencies import { joinArrayExpression } from "../estree/index.js"; import { walkEnter } from "../walker/index.js"; export class Deobfuscate { name = "deobfuscate"; #withCallExpression(node) { const value = joinArrayExpression(node); if (value !== null) { return { type: "Literal", value, raw: value }; } return void 0; } walk(body) { const self = this; walkEnter(body, function walk(node) { if (Array.isArray(node)) { return; } match(node) .with({ type: "CallExpression" }, (node) => { this.replaceAndSkip(self.#withCallExpression(node)); }) .otherwise(() => void 0); }); return body; } } //# sourceMappingURL=deobfuscate.js.map