Duplicate Literals Removal

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


Duplicate Literals Removal replaces duplicate literals with a variable name.

Code Annotation Example

// @jscrambler enable duplicateLiteralsRemoval


Consider the following example:

var foo = "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;

Option Types

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 Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 80+ 80+
Firefox 80+ 80+
Internet Explorer 8+ 8+
Microsoft Edge 111+ 111+
Safari 12.1+ 12.1+

API Parameters


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