Switch it on! 🔦
Added
- [New Refactoring] Convert If/Else to Switch
- [New Refactoring] Merge With Previous If Statement
Changed
Split Declaration and Initialization now handles nested declarations
Consider the following code:
const getLastName = () => {
const lastName = "Doe";
return lastName;
};
If your cursor is on const lastName
, executing the refactoring would have produced this result before:
let getLastName;
getLastName = () => {
let lastName;
lastName = "Doe";
return lastName;
};
Refactoring would have been applied to both declarations. It's valid, but probably not want you wanted to do.
Now it will produce the following, expected output:
const getLastName = () => {
let lastName;
lastName = "Doe";
return lastName;
};
Fixed
- Flip If/Else now works when both if and else branches have return statements
- Inline Function now preserves comments as much as possible