eye_mew
eye_mew

Reputation: 9133

WebStorm: Converting direct-return arrow function into multi-line arrow function

Is an automatic conversion of the following kind possible?

const cuteLittleFunction = input=>value;

to:

const cuteLittleFunction = input=> {
   return value;
};

I find myself doing this a lot, and it gets pretty annoying.

Upvotes: 1

Views: 502

Answers (1)

lena
lena

Reputation: 93728

Put cursor on input, hit Alt+Enter, choose Add braces to arrow function statement:

enter image description here

Code will be changed to

const cuteLittleFunction = input => {
    return value;
};

Upvotes: 4

Related Questions