Package Exports
- question-store
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (question-store) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
question-store

Ask questions, persist the answers. Basic support for i18n and storing answers based on current working directory.
TOC
(TOC generated by verb using markdown-toc)
Install
Install with npm:
$ npm install question-store --saveSimilar to question-cache, but persists answers to disk and supports locales and storing answers based on current working directory.
Usage
var Questions = require('question-store');API
Questions
Create an instance of Questions with the given options.
Params
options{Object}: question store options
Example
var Questions = new Questions(options);.set
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
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.has
Returns true if questions.cache or questions.groups has question name.
returns{String}: The name of the question to check
Example
var name = questions.has('name');
//=> true.del
Delete the given question or any questions that have the given namespace using dot-notation.
returns{String}: The name of the question to delete
Example
questions.del('name');
questions.get('name');
//=> undefined
// using dot-notation
questions.del('author');
questions.get('author.name');
//=> undefined.clearAnswers
Clear all cached answers.
Example
questions.clearAnswers();.clearQuestions
Clear all questions from the cache.
Example
questions.clearQuestions();.clear
Clear all cached questions and answers.
Example
questions.clear();.ask
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 function
Example
questions.ask(['name', 'description'], function(err, answers) {
console.log(answers);
});.normalize
Normalize the given value to return an array of question keys.
Params
- {[type]}: key
returns{[type]}
Question
Create new Question store name, with the given options.
Params
name{String}: The question property name.options{Object}: Store options
Example
var question = new Question(name, options);.answer
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
Force the question to be asked.
returns{undefined}
Example
question.force();Related projects
- answer-store: Store answers to user prompts, based on locale and/or current working directory. | homepage
- inquirer: A collection of common interactive command line user interfaces. | homepage
- question-cache: A wrapper around inquirer that makes it easy to create and selectively reuse questions. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docsOr, if verb is installed globally:
$ verbRunning tests
Install dev dependencies:
$ npm install -d && npm testAuthor
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb, v0.9.0, on February 27, 2016.