Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
prompt-for
Advanced tools
Prompt the user for a series of answers.
$ npm install prompt-for
var prompt = require('prompt-for');
var schema = {
name: 'string',
siblings: 'number',
birthday: 'date',
deceased: 'boolean',
secret: 'password'
};
prompt(schema, function(err, answers){
assert(answers.name == 'Ian');
assert(answers.siblings == 2);
assert(answers.birthday.getTime() == 1343260800000);
assert(answers.deceased == false);
assert(answers.secret == '1234');
});
And if you're being lazy...
prompt(['name', 'website'], function(err, answers){
assert(answers.name == 'Ian');
assert(answers.website == 'ianstormtaylor.com');
});
Or even...
prompt('name', function(err, answers){
assert(answers.name == 'Ian');
});
Define or overwrite default values...
boolean
value is falsedate
value is nowvar prompt = require('prompt-for');
var schema = {
name: {type:'string', default:'Ian'},
siblings: {type:'number', default:42},
birthday: {type:'date', default:'yesterday'},
deceased: {type:'boolean', default:true},
secret: {type:'password', default:'1234'}
};
prompt(schema, function(err, answers){
assert(answers.name == 'Ian');
// ...
});
Disable required for string
and number
...
By default, empty or incorrect answers when asked a string or a number, will be asked again. Set required
to false allows you to skip the question.
var prompt = require('prompt-for');
var schema = {
name: {type:'string', required:false},
siblings: {type:'number', required:false}
};
prompt(schema, function(err, answers){
assert(answers.name == null);
assert(answers.number == null);
});
Prompt the user with the given schema
and optional options
, then callback with fn(err, answers)
. Options default to:
{
color: null,
pad: true,
prefix: '',
separator: ': '
}
MIT
FAQs
Prompt the user for a series of answers.
The npm package prompt-for receives a total of 318 weekly downloads. As such, prompt-for popularity was classified as not popular.
We found that prompt-for 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.