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

Add support for ES6 String template literals refactoring #83

Open
notetiene opened this issue Oct 24, 2016 · 0 comments
Open

Add support for ES6 String template literals refactoring #83

notetiene opened this issue Oct 24, 2016 · 0 comments

Comments

@notetiene
Copy link
Contributor

I think it would be a really useful feature when refactoring code. While knowing the actual String literal* of an expression is impossible without dynamic analysis (running the script in its proper context), refactoring a String concatenation to a String template literal is possible given that we take into account priority of operations. By a template literal, I mean the new ECMA-Script 6 feature that allows us to do:

var str1 = 'Hello';
var str2 = 'World';
var message = str1 + ' ' + str2 + '!';
// message = 'Hello World!'

With the following syntax:

var str1 = 'Hello';
var str2 = 'World';
var message = `${str1} ${str2}!';
// message = 'Hello World!'

Given a concatenation (with + operator), it should be possible to transform both form to the other form.

*This is also the case about knowing the actual concatenation result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant