
Product
Introducing PHP and Composer Support in Socket
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.
Only ask a question one time and store the answer.
Install with npm
$ npm i ask-once --save
var askOnce = require('ask-once');
First time the program is run, the user is prompted to answer a question:
Additional runs of the program will skip prompting the user:

Passing the init option will delete all the stored answers and prompt the user to answer the question again:

Additional runs after clearing the stop will return the newly saved answer:

Passing the force option will force the question to be asked:

Additional runs after forcing the question, will return the newly saved answer:

Options
To re-ask questions or reset the stored values:
options.force: will re-ask the given question or questions, regardless of whether or not previously stored values exists.options.init: will delete the entire store and start over again.Returns a question-asking function that only asks a question if the answer is not already stored.
Params
questions {Object}: Pass your instance of [question-cache] on the questions parameter.store {Object}: Pass your instance of [data-store] on the store parameter.returns {Function}: Function to use when asking questions.Example
var ask = require('ask-once')(questions, store);
Ask a question only if the answer is not stored.
Params
question {String}: Key of the question in the questions cache to ask.options {Object}: Options to control re-initializing the answer or forcing the question.cb {Function}: Callback function with the err and answer parameters.Example
ask('username', function (err, answer) {
if (err) return console.error(err);
console.log(answer);
//=> doowb
});
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright © 2015 Brian Woodward Released under the MIT license.
This file was generated by verb-cli on August 17, 2015.
FAQs
Only ask a question one time and store the answer.
The npm package ask-once receives a total of 28 weekly downloads. As such, ask-once popularity was classified as not popular.
We found that ask-once 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.

Product
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.