Socket
Socket
Sign inDemoInstall

makitso-prompt

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makitso-prompt - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

__tests__/render.js

12

index.js

@@ -393,3 +393,3 @@ const _forEach = require("lodash/forEach");

renderPromptLine(state) {
debug({ renderPromptLine: state });
// debug({ renderPromptLine: state });
const prompt = state.prompt.text;

@@ -440,3 +440,3 @@ const cmd = this.renderCommand(state);

render({ state, prevState, output }) {
debug({ render: { prevState, state } });
// debug({ render: { prevState, state } });

@@ -448,9 +448,7 @@ if (state === prevState) {

if (this.headerChanged(prevState, state)) {
let rows = 0;
if (prevState.header) {
const { rows } = getEndOfLinePos(
this.output.columns,
prevState.header
);
clearLinesAbove(this.output, rows + 1);
({ rows } = getEndOfLinePos(this.output.columns, prevState.header));
}
clearLinesAbove(output, rows + 1);
output.write(`${state.header}`);

@@ -457,0 +455,0 @@ if (state.header.length) {

{
"name": "makitso-prompt",
"version": "1.0.2",
"version": "1.0.3",
"description": "a terminal prompt",

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

@@ -31,12 +31,20 @@ const { Writable } = require("stream");

function parseOutput(output, rows) {
const terminal = new AnsiTerminal(80, (rows = 10), 0);
const parser = new AnsiParser(terminal);
parser.parse(output);
return terminal.toString().replace(/\n+$/, "");
}
async function getResult(prompt, output, rows) {
await waitForKeyPressProcessing(prompt);
const terminal = new AnsiTerminal(80, (rows = 10), 0);
const parser = new AnsiParser(terminal);
parser.parse(output.data);
const result = terminal.toString().replace(/\n+$/, "");
debug({ result, outputData: output.data });
const result = parseOutput(output.data, rows);
return result;
}
module.exports = { newOutput, waitForKeyPressProcessing, getResult };
module.exports = {
newOutput,
waitForKeyPressProcessing,
parseOutput,
getResult
};
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