javascript-obfuscator
javascript-obfuscator copied to clipboard
[Idea] Single letter string literal obfuscation
Sometimes code may contain one-char string literals. My idea to obfuscate it with String.fromCharCode
Example input:
const justRandomExample = "[" + someVariable + "]";
Output:
const justRandomExample = String.fromCharCode(91) + someVariable + String.fromCharCode(93);
It may be useful when the code generates some token or query params, with this feature it may be harder to notice the place in code.
For example, in my project there is a key map for one of key features - fake events generator. When someone notice that it is that keymap - he will know that other events code is nearby.

Maybe you know better ways to mask string instead of String.fromCharCode. For 0-9a-z combinations may be useful number.toString from #681
Like it. Will try in some future.