MichaelXF / js-confuser

JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
https://js-confuser.com
MIT License
168 stars 28 forks source link

Minify not support destructuring assignment #125

Open youdie323323 opened 3 months ago

youdie323323 commented 3 months ago

Describe the bug:

Cant minify code with minify

Config and Small code sample

Config:

{
    target: "browser",
    minify: true,
}

Code:

let objectSlice = [];
objectSlice.push({
    a: 1,
    b: 2,
    c: 2,
})
objectSlice.push({
    a: 2,
    b: 3,
    c: 4,
})
for (let {
    a,
    b,
    c
} of objectSlice) {
    console.log(a);
    console.log(b);
    console.log(c);
}

Expected behavior

Minify should minify code without error and output codes

Actual behavior

\src\dist\transforms\minify.js:427
      if (object.id.type == "ObjectPattern" && object.init.type == "ObjectExpression") {
                                                           ^
TypeError: Cannot read properties of null (reading 'type')

got this error from minify