Package Exports
- question-cache
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-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
question-cache 
A tiny wrapper around inquirer that makes it easy to create and selectively reuse questions. Useful for project generators like yeoman or generate.
Install with npm
npm i question-cache --saveTable of Contents
(Table of contents generated by verb)
Usage
var questions = require('question-cache');
// you must pass your own instance of inquirer!
var inquirer = require('inquirer');
var questions = new Questions({inquirer: inquirer});API
Questions
Create an instance of Questions with the given options.
options{Object}: Pass your instance of inquirer on theinquireroption.
var inquirer = require('inquirer')
var questions = new Questions({inquirer: inquirer});.set
Store a question object by key.
key{String}: Unique question id.value{Object}: Question object that follows inquirer conventions.
questions.set('name', {
type: 'input',
message: 'Project name?',
default: 'undefined'
});.get
Get a question by key.
key{String}: Unique question id.value{Object}: Question object that follows inquirer conventions.
questions.get('name');
//=> {type: 'input', message: 'What is your name?', default: ''}.ask
Ask a question or array of questions.
key{String}: Unique question id.value{Object}: Question object that follows inquirer conventions.
questions.ask(['name', 'homepage']);
//=> { name: 'foo', homepage: 'https://github/foo' }Example
var Questions = require('question-cache');
var inquirer = require('inquirer');
var questions = new Questions({inquirer: inquirer});
questions.set('name', {
type: 'input',
message: 'What is your name?',
default: ''
});
questions.set('repo', {
type: 'input',
message: 'What is the repo URL?',
default: ''
});
questions.ask(['name', 'repo'], function (err, answers) {
console.log(answers);
//=> { repo: 'foo', name: 'bar' }
});Other awesome projects
- generate: Project generator, for node.js.
- yo: CLI tool for running Yeoman generators
- verb: Verb makes it dead simple to generate markdown documentation, using simple templates, with zero configuration required. A project without documentation is like a project that doesn't exist.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on April 19, 2015.