https://github.com/vscodeshift/function-codemorphs
commands for refactoring functions
https://github.com/vscodeshift/function-codemorphs
Last synced: about 1 year ago
JSON representation
commands for refactoring functions
- Host: GitHub
- URL: https://github.com/vscodeshift/function-codemorphs
- Owner: vscodeshift
- License: mit
- Created: 2020-02-02T05:39:36.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T06:15:51.000Z (over 3 years ago)
- Last Synced: 2025-02-10T09:15:16.357Z (over 1 year ago)
- Language: TypeScript
- Size: 765 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @vscodeshift/function-codemorphs
[](https://circleci.com/gh/vscodeshift/function-codemorphs)
[](https://codecov.io/gh/vscodeshift/function-codemorphs)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://marketplace.visualstudio.com/items?itemName=vscodeshift.function-codemorphs)
Commands for refactoring functions
# Convert arrow function body to block statement
### Before
```js
const foo = () => 'foo!'
```
Position cursor anywhere in the arrow function and then run the
**Convert arrow function body to block statement** command.
### After
```js
const foo = () => {
return 'foo!'
}
```
# Convert arrow function body to expression
The inverse of the above. The function body must consist only of
a `return` statement or this will error out.
### Before
```js
const foo = () => {
return 'foo!'
}
```
Position cursor anywhere in the arrow function and then run the
**Convert arrow function body to expression** command.
### After
```js
const foo = () => 'foo!'
```