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
Post a Comment