Refactor constructor's "this" function statements into class methods

How to convert this:

class MyClass {
constructor() {
this.method = ( x, y ) => {
if ( x === 'value' ) {
return y;
}
};

this.method('value', 1);
}
}


Into this:

class MyClass {
constructor() {
this.method('value', 1);
}

method( x, y ) {
if ( x === 'value' ) {
return y;
}
};
}

 

I have tons of legacy code and it would be very convinient if there is any possibility to refactor this cases automatically.

1 comment
Comment actions Permalink

No, there are no such refactorings.

0

Please sign in to leave a comment.