🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

pretty-repl

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
p

pretty-repl

Extends repl.REPLServer to allow for a colorize function

4.0.1
latest
Version published
Weekly downloads
52K
4.48%
Maintainers
33
Weekly downloads
 
Created
Issues
7

Pretty REPL

Node.js CI

An extension of the Node REPL (repl.REPLServer) that applies syntax highlighting as the user types.

Pretty REPL Screenshot

How to use it

Install the package:

$ npm install --save pretty-repl

Use the package:

const repl = require('pretty-repl');

const options = {
    prompt: '→ '
};

repl.start(options);

options is an an object with the same options as repl.REPLServer.

Additionally, it's possible to pass an additional colorize property to the options object:

{
    colorize: function (str) {
        // str is the the string in input.
        // the function should return the string that has been colorized to output in the REPL.
    }
}

In order to highlighting matching pairs of brackets, a colorizeMatchingBracket is also available.

Credits

Pretty repl is inspired and includes code fragments from:

FAQs

Package last updated on 13 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts