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

@inquirer/select

Package Overview
Dependencies
Maintainers
3
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/select - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

26

./dist/cjs/index.js

@@ -25,2 +25,3 @@ "use strict";

const [status, setStatus] = (0, core_1.useState)('pending');
const searchTimeoutRef = (0, core_1.useRef)(undefined);
const bounds = (0, core_1.useMemo)(() => {

@@ -42,3 +43,4 @@ const first = items.findIndex(isSelectable);

const selectedChoice = items[active];
(0, core_1.useKeypress)((key) => {
(0, core_1.useKeypress)((key, rl) => {
clearTimeout(searchTimeoutRef.current);
if ((0, core_1.isEnterKey)(key)) {

@@ -49,2 +51,3 @@ setStatus('done');

else if ((0, core_1.isUpKey)(key) || (0, core_1.isDownKey)(key)) {
rl.clearLine(0);
if (loop ||

@@ -62,2 +65,3 @@ ((0, core_1.isUpKey)(key) && active !== bounds.first) ||

else if ((0, core_1.isNumberKey)(key)) {
rl.clearLine(0);
const position = Number(key.name) - 1;

@@ -69,2 +73,22 @@ const item = items[position];

}
else if ((0, core_1.isBackspaceKey)(key)) {
rl.clearLine(0);
}
else {
// Default to search
const searchTerm = rl.line.toLowerCase();
const matchIndex = items.findIndex((item) => {
if (core_1.Separator.isSeparator(item) || !isSelectable(item))
return false;
return String(item.name || item.value)
.toLowerCase()
.startsWith(searchTerm);
});
if (matchIndex >= 0) {
setActive(matchIndex);
}
searchTimeoutRef.current = setTimeout(() => {
rl.clearLine(0);
}, 700);
}
});

@@ -71,0 +95,0 @@ const message = theme.style.message(config.message);

@@ -25,2 +25,3 @@ "use strict";

const [status, setStatus] = (0, core_1.useState)('pending');
const searchTimeoutRef = (0, core_1.useRef)(undefined);
const bounds = (0, core_1.useMemo)(() => {

@@ -42,3 +43,4 @@ const first = items.findIndex(isSelectable);

const selectedChoice = items[active];
(0, core_1.useKeypress)((key) => {
(0, core_1.useKeypress)((key, rl) => {
clearTimeout(searchTimeoutRef.current);
if ((0, core_1.isEnterKey)(key)) {

@@ -49,2 +51,3 @@ setStatus('done');

else if ((0, core_1.isUpKey)(key) || (0, core_1.isDownKey)(key)) {
rl.clearLine(0);
if (loop ||

@@ -62,2 +65,3 @@ ((0, core_1.isUpKey)(key) && active !== bounds.first) ||

else if ((0, core_1.isNumberKey)(key)) {
rl.clearLine(0);
const position = Number(key.name) - 1;

@@ -69,2 +73,22 @@ const item = items[position];

}
else if ((0, core_1.isBackspaceKey)(key)) {
rl.clearLine(0);
}
else {
// Default to search
const searchTerm = rl.line.toLowerCase();
const matchIndex = items.findIndex((item) => {
if (core_1.Separator.isSeparator(item) || !isSelectable(item))
return false;
return String(item.name || item.value)
.toLowerCase()
.startsWith(searchTerm);
});
if (matchIndex >= 0) {
setActive(matchIndex);
}
searchTimeoutRef.current = setTimeout(() => {
rl.clearLine(0);
}, 700);
}
});

@@ -71,0 +95,0 @@ const message = theme.style.message(config.message);

8

package.json
{
"name": "@inquirer/select",
"version": "2.0.0",
"version": "2.1.0",
"description": "Inquirer select/list prompt",

@@ -57,3 +57,3 @@ "main": "./dist/cjs/index.js",

"dependencies": {
"@inquirer/core": "^7.0.0",
"@inquirer/core": "^7.0.1",
"@inquirer/type": "^1.2.0",

@@ -65,3 +65,3 @@ "ansi-escapes": "^4.3.2",

"devDependencies": {
"@inquirer/testing": "^2.1.11"
"@inquirer/testing": "^2.1.12"
},

@@ -91,3 +91,3 @@ "scripts": {

},
"gitHead": "44016a40bc9e93455dfdb9fa6c25c27c1c109bd3"
"gitHead": "c91196e66689cfc05e9237763e6f95f3eb5342a1"
}

Sorry, the diff of this file is not supported yet

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