Socket
Socket
Sign inDemoInstall

interactive

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

interactive - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

71

interactive.js

@@ -50,2 +50,20 @@ var util = require('util');

var clearLine = function () {
pos = 0;
tmp = "";
display = "";
refreshLine();
};
var execute = function (code) {
try {
stdout.write('\n');
result = eval.apply(global, [code]);
stdout.write('\u001b[37m' + util.inspect(result) + '\u001b[0m');
} catch (e) {
stdout.write(e.toString() + e.stack);
}
stdout.write('\n');
};
var processKey = function( key ){

@@ -93,15 +111,11 @@ switch (key) {

if(exists) {
fs.readFile(path, {encoding:'utf8'}, function(err, data) {
fs.readFile(path, { encoding: 'utf8' }, function(err, data) {
if(err) {
stdout.write("Couldn't load snippet");
stdout.write("\nCouldn't load snippet\n");
clearLine();
} else {
command_memory.push(display);
index = command_memory.length;
stdout.write('\n');
result = eval.apply(global, [data]);
stdout.write('\u001b[37m' + util.inspect(result) + '\u001b[0m\n');
pos = 0;
tmp = "";
display = "";
refreshLine();
execute(data);
clearLine();
}

@@ -111,6 +125,3 @@ });

stdout.write("\nFile doesn't exist!\n");
pos = 0;
tmp = "";
display = "";
refreshLine();
clearLine();
}

@@ -123,8 +134,5 @@ });

if(saved.length === 0) {
stdout.write('\n\u001b[37mundefined\u001b[0m');
stdout.write('\n\u001b[37mundefined\u001b[0m\n');
}
pos = 0;
tmp = "";
display = "";
refreshLine();
clearLine();
break;

@@ -137,23 +145,12 @@ }

if(indentation === 0) {
try {
stdout.write('\n');
result = eval.apply(global, [saved]);
stdout.write('\u001b[37m' + util.inspect(result) + '\u001b[0m');
} catch (e) {
stdout.write(e.toString() + e.stack);
} finally {
saved = "";
}
index = command_memory.length;
if(command_memory.length > 100) {
command_memory.shift();
}
execute(saved);
saved = "";
}
tmp = "";
display = "";
pos = 0;
stdout.write('\n');
refreshLine();
while(command_memory.length > 100) {
command_memory.shift();
}
index = command_memory.length;
clearLine();
break;

@@ -160,0 +157,0 @@ /*---------------------------------------------/

{
"name": "interactive",
"version": "0.1.8",
"version": "0.1.9",
"description": "Togglable interactive mode",

@@ -5,0 +5,0 @@ "main": "interactive.js",

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