Closed fanderlf closed 10 years ago
Hi,
Update to Grasp 0.2.0 http://graspjs.com/blog/2013/12/17/grasp-0.2.0-released/ which add a new filters feature - use the join
filter to print out more than one result.
grasp -s "call[callee=#a]" --replace "d({{.args | join ', '}})" file.js
I tried calling this as
./node_modules/.bin/grasp -s "call[callee=#setImmediate]" --replace "setTimeout({{.args | join ', '}})" build/content/BetterBibTeX.js
(where build/content/BetterBibTeX.js
is just a file a want to process) and I'm getting
Cannot read property 'type' of null
(no line number or other details are outputted to the console).
build/content/BetterBibTeX.js
is a 101KLOC webpacked file though... I am hoping that this error is sufficiently informative.
Hi everybody,
I just stumbled across grasp and I find the idea pretty amazing and powerfull. My first use in real life would be to do a function rename. So image I have a file that looks like this:
This is a call to function a that has several arguments 'a', ['b','c']...
Now I want to rename the function call from a to d. So I tried:
grasp -s "call[callee=#a]" --replace "d({{.args}})" file.js
The output is:
d('a');
What I wanted is:
Of course the number of arguments can vary, so a solution with a fixed number of parameters is not viable.
Any chances that I can get it to work?
Any help appreciated :)
Best, fanderlf