Skip to content

Commit 4215d28

Browse files
committed
doc: code style cleanups in repl.markdown
per: nodejs/node-v0.x-archive#8778 originally submitted by @reggi Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> PR-URL: #2378
1 parent e7e0706 commit 4215d28

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

doc/api/repl.markdown

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,32 +117,31 @@ will share the same global object but will have unique I/O.
117117

118118
Here is an example that starts a REPL on stdin, a Unix socket, and a TCP socket:
119119

120-
var net = require("net"),
121-
repl = require("repl");
122-
123-
connections = 0;
120+
var net = require('net'),
121+
repl = require('repl'),
122+
connections = 0;
124123

125124
repl.start({
126-
prompt: "Node.js via stdin> ",
125+
prompt: 'Node.js via stdin> ',
127126
input: process.stdin,
128127
output: process.stdout
129128
});
130129

131130
net.createServer(function (socket) {
132131
connections += 1;
133132
repl.start({
134-
prompt: "Node.js via Unix socket> ",
133+
prompt: 'Node.js via Unix socket> ',
135134
input: socket,
136135
output: socket
137136
}).on('exit', function() {
138137
socket.end();
139138
})
140-
}).listen("/tmp/node-repl-sock");
139+
}).listen('/tmp/node-repl-sock');
141140

142141
net.createServer(function (socket) {
143142
connections += 1;
144143
repl.start({
145-
prompt: "Node.js via TCP socket> ",
144+
prompt: 'Node.js via TCP socket> ',
146145
input: socket,
147146
output: socket
148147
}).on('exit', function() {
@@ -191,7 +190,7 @@ be emitted.
191190
Example of listening for `reset`:
192191

193192
// Extend the initial repl context.
194-
r = repl.start({ options ... });
193+
var r = repl.start({ options ... });
195194
someExtension.extend(r.context);
196195

197196
// When a new context is created extend it as well.
@@ -213,7 +212,7 @@ accessing `fs` will `require()` the `fs` module as `global.fs`.
213212

214213
The special variable `_` (underscore) contains the result of the last expression.
215214

216-
> [ "a", "b", "c" ]
215+
> [ 'a', 'b', 'c' ]
217216
[ 'a', 'b', 'c' ]
218217
> _.length
219218
3
@@ -225,10 +224,10 @@ a variable to the REPL explicitly by assigning it to the `context` object
225224
associated with each `REPLServer`. For example:
226225

227226
// repl_test.js
228-
var repl = require("repl"),
229-
msg = "message";
227+
var repl = require('repl'),
228+
msg = 'message';
230229

231-
repl.start("> ").context.m = msg;
230+
repl.start('> ').context.m = msg;
232231

233232
Things in the `context` object appear as local within the REPL:
234233

0 commit comments

Comments
 (0)