By default, JSO does not rename global identifiers because doing so would break cross-file references. When you protect multiple files together in a single project, JSO can safely rename globals while maintaining compatibility across all files in the project. That is why this feature appears under Cross-File Obfuscation.
For example, given two files:
|
a.js (before)
function HelperA(){ ... }
b.js (before)
var data=HelperA();
|
→ |
a.js (after)
function g9(){ ... }
b.js (after)
var g10=g9();
|
Both files must be in the same JSO project so that when HelperA is renamed to g9, every reference across all files is updated consistently.
Rename by Rules
In the Global Mapping dialog, you can use Rename by Rules to specify a regular expression that controls which identifiers are renamed.
For example, the pattern ^__ renames only identifiers that start with double underscores:
function __internalGetSetting(){}
function __loadConfig(){}
function ShowLastError(){}
|
→ |
function g11(){}
function g12(){}
function ShowLastError(){}
|
Identifiers matching the rule are treated as private and renamed. Non-matching identifiers are treated as public and keep their original names for third-party access or HTML event handlers like onclick='MyPublicHandler()'.
Custom Identities
Custom Identities is a direct mapping tool for explicit renaming control. Use ? to assign a random name, or specify an exact replacement:
checkValue:?
localData:?
function checkValue(){}
function localData(){}
function PublicMethod(){}
|
→ |
function g13(){}
function g14(){}
function PublicMethod(){}
|
For debugging, you can map identifiers to fixed names:
checkValue:d01
localData:l01
function checkValue(){}
function localData(){}
function PublicMethod(){}
|
→ |
function d01(){}
function l01(){}
function PublicMethod(){}
|
Auto-Generated Mapping
JSO automatically stores the mapping for each project (saved in the .jsop file), ensuring identifiers keep the same names across obfuscation runs. After obfuscating, click Check last auto generated mapping to review the mapping data.
This is also useful for auditing how many global identifiers your project has. You can copy entries into Custom Identities for finer control.