New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

readline-browserify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readline-browserify

Readline implementation for browserify.

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
4.1K
-17.79%
Maintainers
1
Weekly downloads
 
Created
Source

readline-browserify

Readline implementation for browserify.

Install

npm install browserify
npm install readline-browserify

Usage

Copy the css from default.css into your css file.

<div id="commandLineOutput"></div>
<div id="commandLine"></div>

<script>
  var readline = require("readline");

  var rl = readline.createInterface({
    elementId: 'commandLine',

    write: function(data) {
      var output = document.getElementById('commandLineOutput');
      if (output.innerHTML.length > 0) {
        output.innerHTML += "<br>";
      }
      output.innerHTML += line;
    },

    completer: function(linePartial, callback) {
      var cmds = ['command1', 'command2', 'test'];
      var matches = [];
      cmds.forEach(function (cmd) {
        if (cmd.indexOf(linePartial) === 0) {
          matches.push(cmd);
        }
      });
      callback(null, [matches, linePartial]);
    }
  });

  rl.setPrompt('browserify> ');
  rl.prompt();
  rl.on('line', function (line) {
      switch (line.trim()) {
      case 'command1':
        rl.write('ok command1');
        break;
      case 'command2':
        rl.write('ok command2');
        break;
      case 'test':
        rl.write('ok test');
        break;
      default:
        rl.write('Say what? I might have heard `' + line.trim() + '`');
        break;
      }
      rl.prompt();
    });
</script>

Keywords

browserify

FAQs

Package last updated on 23 Aug 2012

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