Skip to content

[Improvement] Destructuring improvement #688

@da411d

Description

@da411d

Destructured variables are not renamed and it is bad because code becomes easier to understand. I think it will be better to assign them to new variable

Example code:

const { getSecret, getSuperSecret } = require("./secret");

const secret = getSecret();
const superSecret = getSuperSecret();

console.log(secret, superSecret);

Current output:

const {getSecret,getSuperSecret}=require(r('0x2')+r('0x0')),P=getSecret(),n=getSuperSecret();console[r('0x1')](P,n);

My way to fix:

const {getSecret:v,getSuperSecret:E}=require(r('0x2')+r('0x0')),P=v(),n=E();console[r('0x1')](P,n);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions