![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A nodejs library for issuing and handling responses to yes/no questions
Supports Node 8+.
npm install yesno
import yesno from 'yesno'; // modern es modules approach
// *OR*
const yesno = require('yesno'); // commonjs approach
const ok = await yesno({
question: 'Are you sure you want to continue?'
});
yesno accepts yes
, y
, no
, and n
values by default.
All yesno responses are case insensitive.
const ok = await yesno({
question: 'Dude, Is this groovy or what?',
yesValues: [ 'groovy' ],
noValues: [ 'or what' ]
});
console.log(ok ? 'Tubular.' : 'Aw, why you gotta be like that?');
Now the question only responds to groovy
as yes and or what
as no.
Sometimes you may want to ensure the user didn't accidentally accept a default. You can disable the default response by passing null as the defaultValue parameter.
const ok = await yesno({
question: 'Are you sure you want to 'rm-rf /' ?',
defaultValue: null
});
By default, if the user enters a value that isn't recognized as an acceptable response, it will print out a message like:
Invalid response.
Answer either yes : (yes, y)
Or no : (no, n)
and re-ask the question. If you want to change this behavior, you can set the invalid handler before asking your question:
const ok = await yesno({
question: 'Ready to continue?',
invalid: function ({ question, defaultValue, yesValues, noValues }) {
process.stdout.write("\n Whoa. That was not a good answer. Well. No more tries for you.");
process.exit(1);
}
});
FAQs
A simple library for asking boolean questions in cli programs
The npm package yesno receives a total of 99,098 weekly downloads. As such, yesno popularity was classified as popular.
We found that yesno demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.