question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Improvement] Destructuring improvement

See original GitHub issue

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);

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Aug 21, 2020

Please extract it as separate issue and add more examples and description

1reaction
sanex3339commented, Jul 31, 2020

Merged to the master I’ll release a new with these changes this weekend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improve your Projects with Destructuring and Modules
DRY - Don't Repeat Yourself is considered a best practice in programming. This applies while working on a single script as well as...
Read more >
Destructuring Variables Performance - Stack Overflow
In conclusion destructured assignments are less computationally efficient than traditional function parameters, as of 2018 in V8. In terms of ...
Read more >
How To Use Destructuring and Arrow Functions to Improve ...
Here are some every day tricks to make your JavaScript code much more readable. Destructuring. Take this (intentionally) deeply nested object. Reading the...
Read more >
Object destructuring best practice in Javascript | by Crunch Tech
As we improve our knowledge, we adapt and update our destructuring ... The destructuring assignment syntax is a JavaScript expression that ...
Read more >
Skipping Values In JavaScript Destructuring - Samantha Ming
Add Comments to Improve Code Readability. When using the blank space option to skip over values, you can also add comments. This will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found