Rename Variables

Determines if variables should be renamed.

Option name: "renameVariables"

Option values: true/false/Function


Input / Output

This example showcases how Rename Variables transforms the code. Try it out by changing the input code and see changes apply in real-time.

Input.js

Output.js


Access the renamed variable

The comment syntax /* @js-confuser-var */ "varName" provides a method to access variable mappings. This is especially useful for eval() scenarios where you want preserve the mapping.

Code

Even if Rename Variables is disabled, the comment /* @js-confuser-var */ will still be removed. (The original name will be returned as a string)

Never rename a variable

The prefix __NO_JS_CONFUSER_RENAME__ disables renaming a certain variable. This can be useful for debugging the obfuscator.

Code


Custom Implementation

options.renameVariables(varName)

Control which variable names are changed. Returns a boolean.

Parameter Type Description
varName string The variable name proposed to be changed.

Options.js


Usage Example

The provided code example will obfuscate the file input.js and write the output to a file named output.js.

Usage Example


Enabled In