Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine multiple assignments into array assignment (and inverse) #547

Open
qpwo opened this issue Mar 15, 2022 · 0 comments
Open

Combine multiple assignments into array assignment (and inverse) #547

qpwo opened this issue Mar 15, 2022 · 0 comments
Labels
✨ Feature New refactoring or feature

Comments

@qpwo
Copy link

qpwo commented Mar 15, 2022

Is this request related to a problem? Please describe.

I was going to ask for "combine multiple conditional assignments into one assignment" because that's my specific task:

// before:
const a = x === 1 ? 3 : 5
const b = x === 1 ? 7: 11
// after:
const [a, b] = x === 1 ? [3, 7] : [5, 11]

But it occured to me that a more general "combine assignments into array assignment" (and ideally its inverse) could make the above task easy enough, and be easier to implement.

Describe the solution you'd like

Select assignments and combine them into one array assignment. Select an array assignment and break it into multiple assignments/declarations.

Additional context

(This is just another wish on my wish-list. Abracadabra is awesome as-is.)

See also #362

@qpwo qpwo added the ✨ Feature New refactoring or feature label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature New refactoring or feature
Projects
None yet
Development

No branches or pull requests

1 participant