Duplicate Literals Removal replaces duplicate literals with a variable name.
// @jscrambler enable duplicateLiteralsRemoval
Consider the following example:
var foo = "http://www.example.xyz";
bar("http://www.example.xyz");
All occurrences of the string literal "http://www.example.xyz"
have been replaced with a single variable name.
var a = "http://www.example.xyz";
var foo = a;
bar(a);
Name | Required | Default Value | Description |
---|---|---|---|
mode | No | [] | Transformation Modes |
Name | Description |
---|---|
optimization | Duplicate Literals Removal will only take action when replacing is worth, meaning that if the result would become bigger the transformation is not applied. |
Browser | Compatible Versions | Tested Versions | Notes |
---|---|---|---|
Chrome | 80+ | 80+ | |
Firefox | 90+ | 90+ | |
Internet Explorer | 8+ | 8+ | |
Microsoft Edge | 116+ | 116+ | |
Safari | 13.1+ | 13.1+ |
Example:
{
"keys": {
"accessKey": "XXXXXX",
"secretKey": "YYYYYY"
},
"applicationId": "ZZZZZZ",
"params": [
{
"name": "duplicateLiteralsRemoval",
"options": {
"mode": []
}
}
]
}