Extend Predicates

Potency Medium
Resilience Medium
Cost Medium
Tags: opaque predicates, predicates

Description

A predicate is an expression that evaluates to either true or false. This transformation extends the predicates in your code with opaque predicates making them harder to understand.

Code Annotation Example

// @jscrambler enable extendPredicates

Examples

The following example is a while statement with a simple predicate:

var i = 0;
while (i < 10) {
  i++;
}

After extending the predicate i < 10 the resulting predicate becomes harder to understand. The following example is a possible output:

var i = 0, j = 10;
while (i < 10 && (j * j * (j + 1) % 2 === 0)) {
  i++;
  j = i * j - 1;
}

API Parameters

Example:

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