javascript - Emacs - replace some string pattern with another string pattern -


i need make js file more friendly node.js module

it has bunch of statements these

function somefunction(jjjj){ 

and need transformed into

exports.somefunction = function(jjjj){ 

even better if there call somefunction in code somefunction(bla);

it replaced exports.somefunction well.

you can use replace-regexp:

m-x replace-regexp <ret> \(function\) \(.*\)(\(.*\)){ <ret> export.\2 = \1(\3)) 

i'm not sure can replace codes of calling functions, however, if there pattern, try.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -