Duplicate Literals Removal

Potency Medium
Resilience Medium
Cost Medium
Tags: duplicate, literal, removal, elimination, optimization, obfuscation

Description

Duplicate Literals Removal replaces duplicate literals with a variable name.

Code Annotation Example

// @jscrambler enable duplicateLiteralsRemoval

Example

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);

Option Types

Name Required Default Value Description
mode No [] Transformation Modes

Mode

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 Compatibility

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+

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "duplicateLiteralsRemoval",
      "options": {
        "mode": []
      }
    }
  ]
}