js-confuser icon indicating copy to clipboard operation
js-confuser copied to clipboard

Default property assignment using passed in variable fails

Open anywhichway opened this issue 11 months ago • 4 comments

Describe the bug:

Default property assignment using passed in variable fails. The property must be assigned using a property name and a value.

Config and Small code sample

Config:

const partners = {joe:{id:1}};

Code:

const contacts = Object.keys(partners).reduce((contacts,name) => {
            const {id} = partners[name];
            // do NOT use contacts.push({id,name});
            // the code breaks with the obfuscator
            contacts.push({id,name:name});
            return contacts;
        },[]);

Expected behavior

[{id:1,name:"joe"}]

Actual behavior

[{id:1}]

Additional context

None

anywhichway avatar Nov 18 '24 09:11 anywhichway