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.
question-store
Advanced tools
Ask questions, persist the answers. Basic support for i18n and storing answers based on current working directory.
Ask questions, persist the answers. Basic support for i18n and storing answers based on current working directory.
(TOC generated by verb using markdown-toc)
Install with npm:
$ npm install question-store --save
Similar to question-cache, but persists answers to disk and supports locales and storing answers based on current working directory.
var Questions = require('question-store');
Create an instance of Questions
with the given options
.
Params
options
{Object}: question store optionsExample
var Questions = new Questions(options);
Cache a question to be asked at a later point. Creates an instance of Question, so any Question
options or settings may be used.
Params
value
{Object|String}: Question object, message (string), or options object.locale
{String}: Optionally pass the locale to use, otherwise the default locale is used.Example
questions.set('drink', 'What is your favorite beverage?');
// or
questions.set('drink', {
type: 'input',
message: 'What is your favorite beverage?'
});
// or
questions.set({
name: 'drink'
type: 'input',
message: 'What is your favorite beverage?'
});
Get question name
, or group name
if question is not found. You can also do a direct lookup using quesions.cache['foo']
.
Params
name
{String}returns
{Object}: Returns the question object.Example
var name = questions.get('name');
//=> question object
Returns true if questions.cache
or questions.groups
has question name
.
returns
{String}: The name of the question to checkExample
var name = questions.has('name');
//=> true
Delete the given question or any questions that have the given namespace using dot-notation.
returns
{String}: The name of the question to deleteExample
questions.del('name');
questions.get('name');
//=> undefined
// using dot-notation
questions.del('author');
questions.get('author.name');
//=> undefined
Clear all cached answers.
Example
questions.clearAnswers();
Clear all questions from the cache.
Example
questions.clearQuestions();
Clear all cached questions and answers.
Example
questions.clear();
Ask one or more questions, with the given options
and callback.
Params
queue
{String|Array}: Name or array of question names.options
{Object|Function}: Question options or callback functioncallback
{Function}: callback functionExample
questions.ask(['name', 'description'], function(err, answers) {
console.log(answers);
});
Normalize the given value to return an array of question keys.
Params
returns
{[type]}Create new Question
store name
, with the given options
.
Params
name
{String}: The question property name.options
{Object}: Store optionsExample
var question = new Question(name, options);
Resolve the answer for the question from the given data sources, then set the question's default
value with any stored hints or answers if not already defined.
Params
answers
{Object}data
{Object}store
{Object}hints
{Object}returns
{Object}Example
question.answer(answers, data, store, hints);
Force the question to be asked.
returns
{undefined}Example
question.force();
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb, v0.9.0, on February 27, 2016.
FAQs
Ask questions, persist the answers. Basic support for i18n and storing answers based on current working directory.
The npm package question-store receives a total of 25,133 weekly downloads. As such, question-store popularity was classified as popular.
We found that question-store 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.