Preview release of shift-refactor

Transform, manipulate, and deobfuscate JavaScript with shift-refactor

$ npm install shift-refactor

What does shift-refactor do?

refactor.rename(`IdentifierExpression[name=”oldName”]`, "newName")

Who is shift-refactor for?

How can I use it?

$ npm install shift-refactor shift-parser
const { RefactorSession } = require('shift-refactor');
const { parseScript } = require('shift-parser');
const fs = require('fs');const fileContents = fs.readFileSync('./source.js', 'utf8');const tree = parseScript(fileContents);const refactor = new RefactorSession(tree);refactor.rename('IdentifierExpression[name="oldName"]', 'newName');refactor.insertBefore(
`ExpressionStatement[expression.type="CallExpression"]`,
node => `console.log("Calling ${node.expression.callee.name}()")`
);
console.log(refactor.print());
oldName();
otherFunction();
console.log("Calling newName()");
newName();
console.log("Calling otherFunction()");
otherFunction();

I write about JavaScript, Reverse Engineering, Security, and Credential Stuffing. Also a speaker, O'Reilly Author, creator of Plato, Director at Shape Security.

I write about JavaScript, Reverse Engineering, Security, and Credential Stuffing. Also a speaker, O'Reilly Author, creator of Plato, Director at Shape Security.