Function Outlining transforms a single or group of statements into a new function declaration.
// @jscrambler define functionOutlining {features: [opaqueFunctions]} as fo
// @jscrambler enable fo
Consider the following function declaration:
function addPrefix (array, prefix) {
var i = array.length - 1;
for (i; i >= 0; i--) {
array[i] = prefix + array[i];
}
}
After transformation the addPrefix
function will depend on functions to evaluate expressions that were previously inline:
var o = function (D) {
return {
M: function () {
var V, W = arguments;
switch (D) {
case 0:
V = W[0] - W[1];
break;
case 1:
V = W[1] + W[0];
break;
}
return V;
},
E: function (v) {
D = v;
}
};
}();
function addPrefix(array, prefix) {
var i;
o.E(0);
i = o.M(array.length, 1);
for (i; i >= 0; i--) {
o.E(1);
array[i] = o.M(array[i], prefix);
}
}
Function Outlining also has the parameter opaqueFunctions
that will difficult determining which function will be executed.
Name | Required | Default Value | Description |
---|---|---|---|
freq | No | 1 | Probability of applying the transformation when the node allows for the transformation to happen. |
features | No | [] | List of available features |
Name | Description |
---|---|
opaqueFunctions | Opaque Functions conceals which functions generated by function outlining are executed |
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": "functionOutlining",
"options": {
"features": []
}
}
]
}