Skip to content

Commit 0d43e88

Browse files
committed
Address nits
1 parent c4f6453 commit 0d43e88

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

doc/api/repl.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ according to a user-defined evaluation function, then output the result. Input
1818
and output may be from `stdin` and `stdout`, respectively, or may be connected
1919
to any Node.js [stream][].
2020

21-
Instances of `repl.REPLServer` support persistent history of prior inputs,
22-
automatic completion of inputs, simplistic Emacs-style line editing, multi-line
23-
inputs, ANSI-styled output, saving and restoring current REPL session state,
24-
error recovery, and customizable evaluation functions.
21+
Instances of `repl.REPLServer` support automatic completion of inputs,
22+
simplistic Emacs-style line editing, multi-line inputs, ANSI-styled output,
23+
saving and restoring current REPL session state, error recovery, and
24+
customizable evaluation functions.
2525

2626
### Commands and Special Keys
2727

2828
The following special commands are supported by all REPL instances:
2929

3030
* `.break` - When in the process of inputting a multi-line expression, entering
31-
the `.break` command (or pressing the `<Ctrl>-C` key combination) will abort
31+
the `.break` command (or pressing the `<ctrl>-C` key combination) will abort
3232
further input or processing of that expression.
3333
* `.clear` - Resets the REPL `context` to an empty object and clears any
3434
multi-line expression currently being input.
3535
* `.exit` - Close the I/O stream, causing the REPL to exit.
3636
* `.help` - Show this list of special commands.
3737
* `.save` - Save the current REPL session to a file:
38-
`>.save ./file/to/save.js`
38+
`> .save ./file/to/save.js`
3939
* `.load` - Load a file into the current REPL session.
40-
`>.load ./file/to/load.js`
40+
`> .load ./file/to/load.js`
4141

4242
The following key combinations in the REPL have these special effects:
4343

@@ -60,11 +60,11 @@ evaluation function when the `repl.REPLServer` instance is created.
6060

6161
The default evaluator supports direct evaluation of JavaScript expressions:
6262

63-
```
63+
```js
6464
> 1 + 1
6565
2
6666
> var m = 2
67-
1
67+
undefined
6868
> m + 1
6969
3
7070
```
@@ -88,7 +88,7 @@ repl.start('> ').context.m = msg;
8888

8989
Properties in the `context` object appear as local within the REPL:
9090

91-
```
91+
```js
9292
$ node repl_test.js
9393
> m
9494
'message'
@@ -117,7 +117,7 @@ REPL environment when used. For instance, unless otherwise declared as a
117117
global or scoped variable, the input `fs` will be evaluated on-demand as
118118
`global.fs = require('fs')`.
119119

120-
```
120+
```js
121121
> fs.createReadStream('./some/file');
122122
```
123123

@@ -126,7 +126,7 @@ global or scoped variable, the input `fs` will be evaluated on-demand as
126126
The default evaluator will, by default, assign the result of the most recently
127127
evaluated expression to the special variable `_` (underscore).
128128

129-
```
129+
```js
130130
> [ 'a', 'b', 'c' ]
131131
[ 'a', 'b', 'c' ]
132132
> _.length
@@ -215,16 +215,16 @@ function myWriter(output) {
215215

216216
## Class: REPLServer
217217

218-
The `repl.REPLServer` class inherits from the [`readline.Interface`][] class.
218+
The `repl.REPLServer` class inherits from the [`readline.Interface`][] class.
219219
Instances of `repl.REPLServer` are created using the `repl.start()` method and
220220
*should not* be created directly using the JavaScript `new` keyword.
221221

222222
### Event: 'exit'
223223

224-
The `'exit'` event is emitted the REPL is exited either by receiving the `.exit`
225-
command as input, the user pressing `<Ctrl>-C` twice to signal `SIGINT`, or by
226-
presing `<Ctrl>-D` to signal `'end'` on the input stream. The listener callback
227-
is invoked without any arguments.
224+
The `'exit'` event is emitted when the REPL is exited either by receiving the
225+
`.exit` command as input, the user pressing `<ctrl>-C` twice to signal `SIGINT`,
226+
or by pressing `<ctrl>-D` to signal `'end'` on the input stream. The listener
227+
callback is invoked without any arguments.
228228

229229
```js
230230
replServer.on('exit', () => {
@@ -260,7 +260,7 @@ r.on('reset', initializeContext);
260260
When this code is executed, the global `'m'` variable can be modified but then
261261
reset to its initial value using the `.clear` command:
262262

263-
```
263+
```js
264264
$ ./node example.js
265265
>m
266266
'test'
@@ -327,7 +327,7 @@ The `replServer.displayPrompt()` method readies the REPL instance for input
327327
from the user, printing the configured `prompt` to a new line in the `output`
328328
and resuming the `input` to accept new input.
329329

330-
When multi-line input is being entered, an ellipsis is printed rather the the
330+
When multi-line input is being entered, an ellipsis is printed rather than the
331331
'prompt'.
332332

333333
When `preserveCusor` is `true`, the cursor placement will not be reset to `0`.
@@ -381,9 +381,8 @@ Node.js itself uses the `repl` module to provide its own interactive interface
381381
for executing JavaScript. This can used by executing the Node.js binary without
382382
passing any arguments (or by passing the `-i` argument):
383383

384-
```
384+
```js
385385
$ node
386-
Type '.help' for options.
387386
> a = [1, 2, 3];
388387
[ 1, 2, 3 ]
389388
> a.forEach((v) => {
@@ -436,7 +435,7 @@ terminal settings which will allow you to use with `rlwrap`.
436435

437436
For example, you could add this to your bashrc file:
438437

439-
```
438+
```text
440439
alias node="env NODE_NO_READLINE=1 rlwrap node"
441440
```
442441

0 commit comments

Comments
 (0)