Transpiling Javascript to Javascript replacing objects and methods -


is possible convert js file containing object myobject method mymethod1() :

 myobject.mymethod1(): 

to js file object yourobject method yourmethod() this:

 yourobject.yourmethod2(); 

one of possible ways writing file manipulation program 1 replace occurrences using regex or simple text search referring sample file, naive , eager know if there other possibilities. writing generic javascript library produces same interface different libraries each library having different methods internally implement same functionality. eg, if library has object a1 method foo , library b has object b1 method bar , foo , bar internally implement same functionality, trying create solution wherein calling method meh on object s1 call either a1.foo() or b1.bar() based on simple configuration.

this very difficult achieve

myobject.mymethod1() 

is equivalent

myobject['mymethod1']() 

where string 'mymethod1' result of arbitrary expressions , variables, impossible trace in practice.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -