Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pretty-repl

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pretty-repl

Extends repl.REPLServer to allow for a colorize function

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Pretty REPL

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 PrettyREPLServer = require('.');

const options = {
    prompt: '→ '
};

new PrettyREPLServer(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.
    }
}

Known issues

  • Only works properly on Node 13+. Unfortunately, Node 12 does some trickery when starting the REPL with repl.start() which makes it behave differently than when the REPL is started with new repl.REPLServer(). When REPLServer is instantiated directly, everyhting works fine until the REPL needs to throw an error. This is not true only for FancyREPLServer, it's the same also for the default REPLServer that ships with Node.

Credits

Pretty repl is inspired and includes code fragments from:

Keywords

FAQs

Package last updated on 05 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc