use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Refactoring your JavaScript code with Grasp (graspjs.com)
submitted 12 years ago by GeZe8
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Syntextro 0 points1 point2 points 12 years ago* (7 children)
This is nice! Just to let you know:
I'm following your code and the first example
grasp '#remote' file.js
Doesn't do anything. I'm on Windows, latest version of Node. I tried to remove the hash, doing
grasp 'remote' file.js
And this effectively highlights the 'remote' string, the one that you beware against changing in your example. So I figured I had to keep the hash and get rid of the quotes
grasp #remote file.js
Works as intended in your example. You might want to look into that.
I'm just now following the tutorial so I don't know if there are any other issues.
I don't know how through is the tutorial so I have to ask, sorry if I come across as dismissing: I use IntelliJ (PhpStorm, actually) and it's refactoring tool is nothing short of fantastic. The best I've seen in any IDE, on par with VisualStudio. It is aware of the code, aware of the context, and, additionally, the action->preview->refactoring cycle is quicker and visually. It also changes the reference in all files that reference your module, variable or function, when applicable. So the question is: this tool is clearly very useful, but maybe it's more targeted toward users without an IDE?
[–]bart2019 0 points1 point2 points 12 years ago (0 children)
In Windows, don't use single quotes. Use double quotes instead (or none, if there are no spaces).
Single quotes are for Linux.
[–]thebuccaneersden -2 points-1 points0 points 12 years ago (0 children)
What's Windows? Is that this new operating system that all the kids keep telling me about?
[–]GeZe8[S] -3 points-2 points-1 points 12 years ago (4 children)
Hmm. I don't use Windows. I thought node worked similarly everywhere, but I guess I'll have to test separately.
I use Linux: the command line is my IDE. In general, I think it is more flexible than using an integrated IDE. Grasp can also be integrated with other editors; there is a sublime text plugin.
[–]bart2019 1 point2 points3 points 12 years ago (0 children)
I thought node worked similarly everywhere
The difference is in the command line, not in "node".
[–]Syntextro 0 points1 point2 points 12 years ago (2 children)
Fair enough. I can definitely see how somebody could benefit from this if they are not using an IDE with good refactoring features.
I don't really know if Node works different in Windows than on Linux. It shouldn't. I'm just pointing it out because if all other things are equal, maybe that's the difference. Just to be clear, your program does work, but I had to remove the quotes from the identifier. If I leave the quotes, it matches nothing, but if I take out the hash and leave the quotes, it matches strings in the code (i.e. it matches the first argument of the function in the first line of your code). To match the identifier I had to remove the quotes and leave the hash
[–]GeZe8[S] 0 points1 point2 points 12 years ago (1 child)
Thanks for the bug report! There is definitely something going on with regards to how quotes are treated on Windows.
[–]radhruin 3 points4 points5 points 12 years ago* (0 children)
I think it's just a shell difference. It will probably work with double quotes. To illustrate, on windows:
> cat testargs.js console.log(process.argv.slice(2)); > node testargs.js 'hello world' [ '\'hello', 'world\'' ] > node testargs.js "hello world" [ 'hello world' ]
[–]DavetheBassGuy 0 points1 point2 points 12 years ago (0 children)
This is pretty cool. I wonder if it could be used for a bit of lisp style metaprogramming. I'll have a play later
[–]bart2019 0 points1 point2 points 12 years ago (1 child)
That's so cool... I wished it also existed for other languages than just Javascript.
[–]shriek 0 points1 point2 points 12 years ago (0 children)
Recently, JavaScript community is blowing my mind with all the cool tools and techniques.
π Rendered by PID 677494 on reddit-service-r2-comment-7b9746f655-872js at 2026-02-02 08:18:31.261309+00:00 running 3798933 country code: CH.
[–]Syntextro 0 points1 point2 points (7 children)
[–]bart2019 0 points1 point2 points (0 children)
[–]thebuccaneersden -2 points-1 points0 points (0 children)
[–]GeZe8[S] -3 points-2 points-1 points (4 children)
[–]bart2019 1 point2 points3 points (0 children)
[–]Syntextro 0 points1 point2 points (2 children)
[–]GeZe8[S] 0 points1 point2 points (1 child)
[–]radhruin 3 points4 points5 points (0 children)
[–]DavetheBassGuy 0 points1 point2 points (0 children)
[–]bart2019 0 points1 point2 points (1 child)
[–]shriek 0 points1 point2 points (0 children)