New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cli-interact

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

cli-interact - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

30

examples/getNumber.js

@@ -14,5 +14,31 @@ //==============================

answer = query('Give me a number');
answer = query('Case 1: You MAY give me a number: ', {
allowNoAnswer : true
});
if (answer !== '') {
console.log('No answer.');
} else {
console.log('Thank you for: ', answer);
}
console.log();
answer = query('Case 2: You MUST give me a number: ');
console.log('you answered:', answer);
console.log('the typeof of that is:', typeof answer)
console.log('the typeof of that is:', typeof answer);
console.log();
answer = query('Case 3: You MUST give me an integer: ', true);
console.log('Thank you for: ', answer);
console.log();
answer = query('Case 4: You MAY give me an answer. If you do, it MUST be an integer', {
allowNoAnswer : true
, requireInteger : true
});
if (answer !== '') {
console.log('No answer.');
} else {
console.log('Thank you for: ', answer);
}

@@ -130,6 +130,17 @@ //==============================

function getNumber (promptText, flagIntOnly) {
function getNumber (promptText, opts) {
var answer;
var flagIntOnly;
var flagAllowNoAnswer;
var value;
// for historical compatibility
if (opts === true) {
flagIntOnly = true;
} else if (opts) {
// better be an object;
flagIntOnly = opts.requireInteger;
flagAllowNoAnswer = opts.allowNoAnswer
}
while (true) {

@@ -141,2 +152,4 @@ answer = readlineSync.question(promptText);

process.exit();
} else if (flagAllowNoAnswer && (answer === '')) {
break;
} else {

@@ -143,0 +156,0 @@ if (flagIntOnly) {

2

package.json
{
"name": "cli-interact",
"version": "0.1.8",
"version": "0.1.9",
"title": "cli interact",

@@ -5,0 +5,0 @@ "description": "Simple helper tools for interacting synchronously with user at command line",

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