Skip to main content
ReplOptions - repl - Node documentation
interface ReplOptions

Usage in Deno

import { type ReplOptions } from "node:repl";
<div class="alert alert-warning"><div><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M12 9v4" /> <path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z" /> <path d="M12 16h.01" /> </svg> Deno compatibility</div><div><p> This symbol is not supported.</p> </div></div>

Properties

optional
prompt: string | undefined

The input prompt to display.

optional
input: ReadableStream | undefined

The Readable stream from which REPL input will be read.

optional
output: WritableStream | undefined

The Writable stream to which REPL output will be written.

optional
terminal: boolean | undefined

If true, specifies that the output should be treated as a TTY terminal, and have ANSI/VT100 escape codes written to it. Default: checking the value of the isTTY property on the output stream upon instantiation.

optional
eval: REPLEval | undefined

The function to be used when evaluating each given line of input. Default: an async wrapper for the JavaScript eval() function. An eval function can error with repl.Recoverable to indicate the input was incomplete and prompt for additional lines.

optional
preview: boolean | undefined

Defines if the repl prints output previews or not.

optional
useColors: boolean | undefined

If true, specifies that the default writer function should include ANSI color styling to REPL output. If a custom writer function is provided then this has no effect.

optional
useGlobal: boolean | undefined

If true, specifies that the default evaluation function will use the JavaScript global as the context as opposed to creating a new separate context for the REPL instance. The node CLI REPL sets this value to true.

optional
ignoreUndefined: boolean | undefined

If true, specifies that the default writer will not output the return value of a command if it evaluates to undefined.

optional
writer: REPLWriter | undefined

The function to invoke to format the output of each command before writing to output.

optional
completer:

An optional function used for custom Tab auto completion.

A flag that specifies whether the default evaluator executes all JavaScript commands in strict mode or default (sloppy) mode. Accepted values are:

  • repl.REPL_MODE_SLOPPY - evaluates expressions in sloppy mode.
  • repl.REPL_MODE_STRICT - evaluates expressions in strict mode. This is equivalent to prefacing every repl statement with 'use strict'.
optional
breakEvalOnSigint: boolean | undefined

Stop evaluating the current piece of code when SIGINT is received, i.e. Ctrl+C is pressed. This cannot be used together with a custom eval function.