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.

Destructure of function parameters - Refactoring

See original GitHub issue
const calllback = event=> {
   let {target} = event;
   // code with used target
}

to

const calllback = ({target})=> {
   // code with used target
}

Same in the opposite direction and with a more complex and deep destructure and function content.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
lukaszpolowczykcommented, Jun 9, 2018

@Shinigami92 Of course (May optionally be const {target} = event). Sorry for the mistake.

1reaction
Kingwlcommented, Aug 25, 2020

Well, It’s good to take a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refactoring Your Function Parameters - Good Work
In this lesson, we take a function and refactor it to make both the function definition, and the way we call the function...
Read more >
Ways to Refactor JavaScript Code You May Have Missed
The destructuring assignment syntax can decompose objects into variables, so we can use properties the same way that we use variables. To ...
Read more >
Extract Functions Arguments using Destructure in JavaScript
Extract Functions Arguments using Destructure in JavaScript. ES6 Destructuring is terrific at extracting value from your arguments. So the next time you see ......
Read more >
Refactoring JavaScript | WebStorm Documentation
Generate destructuring parameters for a function. Position the caret at the parameters of a function and press Alt+Enter .
Read more >
JS Refactoring Combo: Introduce Object Destructuring
Destructuring is a way to access array values or object properties. It can be used in variable declarations, parameters, and catch clauses.
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