Socket
Socket
Sign inDemoInstall

inquirer

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer - npm Package Compare versions

Comparing version 0.11.4 to 0.12.0

4

lib/objects/choices.js

@@ -83,3 +83,3 @@ 'use strict';

Choices.prototype.where = function (whereClause) {
return _.where(this.realChoices, whereClause);
return _.filter(this.realChoices, whereClause);
};

@@ -95,3 +95,3 @@

Choices.prototype.pluck = function (propertyName) {
return _.pluck(this.realChoices, propertyName);
return _.map(this.realChoices, propertyName);
};

@@ -98,0 +98,0 @@

@@ -138,4 +138,4 @@ /**

this.selection = _.pluck(choices, "short");
return _.pluck(choices, "value");
this.selection = _.map(choices, "short");
return _.map(choices, "value");
};

@@ -142,0 +142,0 @@

@@ -80,3 +80,3 @@ /**

if ( this.status === "answered" ) {
message += chalk.cyan( this.selected.name );
message += chalk.cyan( this.selected.short || this.selected.name );
} else if ( this.status === "expanded" ) {

@@ -83,0 +83,0 @@ var choicesStr = renderChoices(this.opt.choices, this.selectedKey);

@@ -20,7 +20,7 @@ 'use strict';

normalizedUpKey: keypress.filter(function (e) {
return e.key.name === 'up' || e.key.name === 'k';
return e.key.name === 'up' || e.key.name === 'k' || (e.key.name === 'p' && e.key.ctrl);
}).share(),
normalizedDownKey: keypress.filter(function (e) {
return e.key.name === 'down' || e.key.name === 'j';
return e.key.name === 'down' || e.key.name === 'j' || (e.key.name === 'n' && e.key.ctrl);
}).share(),

@@ -27,0 +27,0 @@

@@ -8,5 +8,2 @@ 'use strict';

// Prevent crashes on environments where the width can't be properly detected
cliWidth.defaultWidth = 80;
function height(content) {

@@ -20,10 +17,2 @@ return content.split('\n').length;

function normalizedCliWidth() {
var width = cliWidth() || cliWidth.defaultWidth;
if (process.platform === 'win32') {
return width - 1;
}
return width;
}
var ScreenManager = module.exports = function (rl) {

@@ -59,6 +48,7 @@ // These variables are keeping information to allow correct prompt re-rendering

var cursorPos = this.rl._getCursorPos();
var width = this.normalizedCliWidth();
content = forceLineReturn(content);
content = forceLineReturn(content, width);
if (bottomContent) {
bottomContent = forceLineReturn(bottomContent);
bottomContent = forceLineReturn(bottomContent, width);
}

@@ -68,3 +58,3 @@ // Manually insert an extra line if we're at the end of the line.

// current line.
if (rawPromptLine.length % normalizedCliWidth() === 0) {
if (rawPromptLine.length % width === 0) {
content = content + '\n';

@@ -81,3 +71,3 @@ }

// content in order to correctly cleanup and re-render.
var promptLineUpDiff = Math.floor(rawPromptLine.length / normalizedCliWidth()) - cursorPos.rows;
var promptLineUpDiff = Math.floor(rawPromptLine.length / width) - cursorPos.rows;
var bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);

@@ -116,6 +106,16 @@ if (bottomContentHeight > 0) {

function breakLines(lines) {
ScreenManager.prototype.normalizedCliWidth = function () {
var width = cliWidth({
defaultWidth: 80,
output: this.rl.output
});
if (process.platform === 'win32') {
return width - 1;
}
return width;
};
function breakLines(lines, width) {
// Break lines who're longuer than the cli width so we can normalize the natural line
// returns behavior accross terminals.
var width = normalizedCliWidth();
var regex = new RegExp(

@@ -133,4 +133,4 @@ '(?:(?:\\033\[[0-9;]*m)*.?){1,' + width + '}',

function forceLineReturn(content) {
return _.flatten(breakLines(content.split('\n'))).join('\n');
function forceLineReturn(content, width) {
return _.flatten(breakLines(content.split('\n'), width)).join('\n');
}
{
"name": "inquirer",
"version": "0.11.4",
"version": "0.12.0",
"description": "A collection of common interactive command line user interfaces.",

@@ -28,5 +28,5 @@ "main": "lib/inquirer.js",

"cli-cursor": "^1.0.1",
"cli-width": "^1.0.1",
"cli-width": "^2.0.0",
"figures": "^1.3.5",
"lodash": "^3.3.1",
"lodash": "^4.3.0",
"readline2": "^1.0.1",

@@ -33,0 +33,0 @@ "run-async": "^0.1.0",

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