Structural replace ES5 prototype to ES6 class
Apologies if this belongs in WebStorm, I use IntelliJ IDEA so posting here.
I am trying to convert something like this to a ES6 class
function ClassName(param1, param2) {
//statements
}
ClassName.prototype.methodName = function() {
//statements
};
This is as far as I got -
I can't figure out how to match the constructor plus all the following prototype methods and replace it all in one shot. The above template also seems to be buggy (or I am doing something wrong), some methods are missing their return keyword and some have additional braces inside the method body.
Please sign in to leave a comment.
I can’t think of a way to do this using SSR right now, so I don’t think it is possible:(