From a678ef666c3213e5245a607a6aced58bda01959f Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Thu, 12 Dec 2019 23:08:16 +0100 Subject: [PATCH 1/2] doc: update REPL documentation to instantiate the REPL The documentation currently states that it's not intended to directly instantiate REPL instances. It is unknown for what reason that's recommended as it does seem a proper way to handle new REPL instances. --- doc/api/repl.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/api/repl.md b/doc/api/repl.md index 21f5193c12c947..6d944299342d2b 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -332,10 +332,20 @@ function myWriter(output) { added: v0.1.91 --> +* `options` {Object|string} See [`repl.start()`][] * Extends: {readline.Interface} -Instances of `repl.REPLServer` are created using the `repl.start()` method and -*should not* be created directly using the JavaScript `new` keyword. +Instances of `repl.REPLServer` are created using the [`repl.start()`][] method +or directly using the JavaScript `new` keyword. + +```js +const repl = require('repl'); + +const options = { useColors: true }; + +const firstInstance = repl.start(options); +const secondInstance = new repl.REPLServer(options); +``` ### Event: 'exit'