Socket
Socket
Sign inDemoInstall

@inquirer/checkbox

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/checkbox - npm Package Compare versions

Comparing version 0.0.10-alpha.0 to 0.0.11-alpha.0

8

demo.js

@@ -11,4 +11,4 @@ const checkbox = require('.');

{ name: 'yarn', value: 'yarn' },
{ name: 'jspm', value: 'jspm', disabled: true }
]
{ name: 'jspm', value: 'jspm', disabled: true },
],
});

@@ -45,6 +45,6 @@ console.log('Answer:', answer);

{ value: 'Y' },
{ value: 'Z' }
]
{ value: 'Z' },
],
});
console.log('Answer:', answer);
})();

@@ -9,3 +9,3 @@ const { createPrompt } = require('@inquirer/core');

module.exports = createPrompt(
readline => ({
(readline) => ({
onKeypress: (value, key, { cursorPosition = 0, choices }, setState) => {

@@ -33,16 +33,16 @@ let newCursorPosition = cursorPosition;

return choice;
})
}),
});
} else if (key.name === 'a') {
const selectAll = Boolean(choices.find(choice => !choice.checked));
const selectAll = Boolean(choices.find((choice) => !choice.checked));
setState({
choices: choices.map(choice =>
choices: choices.map((choice) =>
Object.assign({}, choice, { checked: selectAll })
)
),
});
} else if (key.name === 'i') {
setState({
choices: choices.map(choice =>
choices: choices.map((choice) =>
Object.assign({}, choice, { checked: !choice.checked })
)
),
});

@@ -66,3 +66,3 @@ } else if (isNumberKey(key)) {

return choice;
})
}),
});

@@ -72,5 +72,5 @@ }

mapStateToValue: ({ choices }) => {
return choices.filter(choice => choice.checked).map(choice => choice.value);
return choices.filter((choice) => choice.checked).map((choice) => choice.value);
},
paginator: new Paginator(readline)
paginator: new Paginator(readline),
}),

@@ -83,3 +83,3 @@ (state, { paginator }) => {

const selection = choices
.filter(choice => choice.checked)
.filter((choice) => choice.checked)
.map(({ name, value }) => name || value);

@@ -94,3 +94,3 @@ return `${prefix} ${message} ${chalk.cyan(selection.join(', '))}`;

`${chalk.cyan.bold('<a>')} to toggle all`,
`${chalk.cyan.bold('<i>')} to invert selection`
`${chalk.cyan.bold('<i>')} to invert selection`,
];

@@ -97,0 +97,0 @@ helpTip = ` (Press ${keys.join(', ')})`;

{
"name": "@inquirer/checkbox",
"version": "0.0.10-alpha.0",
"version": "0.0.11-alpha.0",
"description": "Inquirer checkbox prompt",

@@ -17,4 +17,4 @@ "main": "index.js",

"dependencies": {
"@inquirer/core": "^0.0.10-alpha.0",
"chalk": "^3.0.0",
"@inquirer/core": "^0.0.11-alpha.0",
"chalk": "^4.1.0",
"figures": "^3.0.0"

@@ -25,3 +25,3 @@ },

},
"gitHead": "7a699cc7566b4b6bc9a1e8d93490d3f5a01685ef"
"gitHead": "434228aba4908e22063eef37869a427bb605337b"
}
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