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

replize

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replize

Simple REPL for embedding into applications

  • 0.0.3
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

REPLize

Add a REPL into your application.

npm install replize

Usage

replize is most useful when attached onto instances (however, it can be used in any way you like).

It exports a constructor that takes a configuration hash:

  • port number (required) Port to listen on. This is how you connect to it
  • host string (default: localhost) Interface to bind to
  • prompt string (default: > ) REPL prompt
  • context object To expose something for REPL you attach it to this object. Key name will become the object name you call in the REPL (see example below).

bin folder contains a REPL client you can use:

./bin/repl <port>

Example

var Repl = require('replize')

function Foo() {
  this.repl = Repl({
    port: 20000,
    context: {
      'foo': this
    }
  })
}

Foo.prototype.log = function(){
  console.log('foo')
}

Connect to this instance:

$ ./bin/repl 20000

and type

> foo.log()

and you will see foo instance print foo into console.

See example folder.

Keywords

FAQs

Package last updated on 18 Jul 2013

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