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

[RFC] Node.prototype.wrap #11

Open
aleclarson opened this issue May 30, 2018 · 0 comments
Open

[RFC] Node.prototype.wrap #11

aleclarson opened this issue May 30, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@aleclarson
Copy link
Collaborator

node.wrap('try {\n', '\n}')
// identical to:
node.before('try {\n')
node.after('\n}')

You can wrap the node with anything, but the main use cases are blocks and call expressions.

Do we have a separate method for "block wrapping" that indents the wrapped node and implicitly adds the newline characters seen above? Or maybe passing true as the third argument can do that?

node.wrap('try {', '}', true)
// or
node.bwrap('try {', '}')

Not a big fan of the name bwrap though.

@aleclarson aleclarson added the enhancement New feature or request label May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant