Node's REPL features include _ to refer to the last value as well as a few 
commands starting with a period [1]. I've found these to really interfere 
with day-to-day development and experimentation: at least the n_ executable 
[2] allows one to use _ as lodash, but I haven't found a similar workaround 
to the special commands like .break and .save, which cause Node REPL to 
reject pasted code using the following code formatting:

var a = fs.readFileSync('file', 'utf8')
            .split('\n')
            .filter(s => s.search(' : ') >= 0)
            .map(s => s.replace(/ /g, '').split(':'));

Node REPL fails to parse this valid JavaScript snippet because it doesn't 
have special commands ".split" or ".filter", etc. One really roundabout 
workaround: I run a regexp in my editor to move the dot from the beginning 
of the line to the end of the previous line, just so I can copy-paste (or 
in my case, send to tmux). But as soon as I re-run clang-format, the above 
REPL-incompatible formatting is reinstated, making this workaround really 
insufferable.

Is it feasible to disable these special commands, by either launching a 
custom Node REPL, or even by editing the Node source? Any tips or pitfalls 
to watch out for would be appreciated. Many thanks,

Ahmed

[1] https://nodejs.org/api/repl.html#repl_repl_features
[2] https://www.npmjs.com/package/n_

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/efd072f8-08a7-4c35-8379-59684e45dabd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to