File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -1076,6 +1076,37 @@ Available values:
1076
1076
* ` 'function' ` : appends function wrappers. More slow performance than with ` variable ` but allows to additionally shift the ` stringArray ` index.
1077
1077
1078
1078
Highly recommended to use ` function ` wrappers for higher obfuscation when a performance loss doesn't have a high impact on an obfuscated application.
1079
+
1080
+ Example of the ` 'function' ` option value:
1081
+ ```
1082
+ // input
1083
+ const foo = 'foo';
1084
+
1085
+ function test () {
1086
+ const bar = 'bar';
1087
+ }
1088
+
1089
+ // output
1090
+ const a = [
1091
+ 'foo',
1092
+ 'bar'
1093
+ ];
1094
+ const b = function (c, d) {
1095
+ c = c - 0x0;
1096
+ let e = a[c];
1097
+ return e;
1098
+ };
1099
+ const d = function (c, f) {
1100
+ return b(c - '0x372', f);
1101
+ };
1102
+ const foo = d('0x372');
1103
+ function test() {
1104
+ const e = function (c, f) {
1105
+ return d(c - -'0x260', f);
1106
+ };
1107
+ const c = e('0x113');
1108
+ }
1109
+ ```
1079
1110
1080
1111
### ` stringArrayThreshold `
1081
1112
Type: ` number ` Default: ` 0.8 ` Min: ` 0 ` Max: ` 1 `
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNodes' ;
4
+ import { IdentifierNamesGenerator } from '../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator' ;
5
+ import { StringArrayWrappersType } from '../../src/enums/node-transformers/string-array-transformers/StringArrayWrappersType' ;
4
6
5
7
( function ( ) {
6
8
const JavaScriptObfuscator : any = require ( '../../index' ) ;
7
9
8
10
let obfuscatedCode : string = JavaScriptObfuscator . obfuscate (
9
11
`
10
- const s = '\0ab cd';
12
+ const foo = 'foo';
13
+
14
+ function test () {
15
+ const bar = 'bar';
16
+ }
11
17
` ,
12
18
{
13
19
...NO_ADDITIONAL_NODES_PRESET ,
14
- compact : false
20
+ compact : false ,
21
+ identifierNamesGenerator : IdentifierNamesGenerator . MangledIdentifierNamesGenerator ,
22
+ stringArray : true ,
23
+ stringArrayThreshold : 1 ,
24
+ stringArrayWrappersChainedCalls : true ,
25
+ stringArrayWrappersCount : 1 ,
26
+ stringArrayWrappersType : StringArrayWrappersType . Function
15
27
}
16
28
) . getObfuscatedCode ( ) ;
17
29
You can’t perform that action at this time.
0 commit comments