S
S
Sergi0Limit2015-08-03 15:18:29
JavaScript
Sergi0Limit, 2015-08-03 15:18:29

How to translate JavaScript functions, variables, etc into object methods in PhpStorm?

Hello.
Is there a quick way to translate the entire contents of a JS file (selection) into object elements?
Example:

var var1=null;
var var2="";
function foo(foovar){
var1 = var2;
}
function bar(barvar){
foo(barvar);
}

translate into
var SomeObj = {
_var1:null,
_var2:"",
foo:function(foovar){
this._var1 = this._var2;
},
bar:function(barvar){
this.foo(barvar);
}
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question