Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

question-cache

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

question-cache - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

23

index.js

@@ -16,3 +16,2 @@ 'use strict';

var sessionAnswers = {};
var forced = {};

@@ -55,2 +54,3 @@ /**

this.project = opts.project || utils.project(process.cwd());
this.Question = opts.Question || Question;
this.data = opts.data || {};

@@ -129,3 +129,4 @@ this.cache = {};

var question = new Question(name, val, options);
options = utils.merge({}, this.options, options);
var question = new this.Question(name, val, options);
debug('questions#set "%s"', name);

@@ -417,5 +418,6 @@

var questions = this.buildQueue(queue);
var answers = this.answers;
var self = this;
utils.async.reduce(questions, this.answers, function(answers, key, next) {
utils.eachSeries(questions, function(key, next) {
debug('asking question "%s"', key);

@@ -429,4 +431,3 @@

var options = question._options = question.opts(opts);
var val = question.answer(answers, data, self);
debug('using answer %j', val);
var val = question.getAnswer(answers, data, self);

@@ -437,3 +438,4 @@ // emit question before building options

// get val again after emitting `ask`
val = question.answer(answers, data, self);
val = question.getAnswer(answers, data, self);
debug('using answer %j', val);

@@ -447,2 +449,3 @@ // re-build options object after emitting ask, to allow

debug('skipping question "%s", using answer "%j"', key, val);
self.emit('answer', val, key, question, answers);
question.next(val, self, answers, next);

@@ -454,8 +457,2 @@ return;

var isForced = force === true || utils.matchesKey(force, key);
if (!forced.hasOwnProperty(key)) {
forced[key] = true;
} else {
isForced = false;
}
if (!isForced && utils.isAnswer(val)) {

@@ -501,3 +498,3 @@ debug('question "%s", using answer "%j"', key, val);

}
}, function(err, answers) {
}, function(err) {
if (err) return cb(err);

@@ -504,0 +501,0 @@ self.emit('answers', answers);

@@ -64,3 +64,5 @@ /*!

if (typeof question.options.next === 'function') {
question.next = question.options.next.bind(question);
question.next = function() {
question.options.next.apply(question, arguments);
};
return;

@@ -140,2 +142,7 @@ }

Question.prototype.setAnswer = function(val) {
this.answer = val;
return this;
};
/**

@@ -157,3 +164,3 @@ * Resolve the answer for the question from the given data sources, then

Question.prototype.answer = function(answers, data, app) {
Question.prototype.getAnswer = function(answers, data, app) {
debug('looking for answer for: "%s"', this.name);

@@ -176,3 +183,3 @@

// app.store, if one exists
if (app.store && typeof answer === 'undefined') {
if (typeof answer === 'undefined' && app.store) {
answer = app.store.get(this.name);

@@ -182,3 +189,3 @@ debug('answer:store.get %j', util.inspect(answer));

// app.globals store, if one exists
if (app.globals && typeof answer === 'undefined' && this.options.global === true) {
if (typeof answer === 'undefined' && this.options.global === true && app.globals) {
answer = app.globals.get(this.name);

@@ -188,4 +195,5 @@ debug('answer:globals.get %j', util.inspect(answer));

// if `type` is checkbox, return now. we don't want to set hints for checkboxes
if (this.type === 'checkbox') {
if (this.type === 'checkbox' || this.options.hints === false) {
debug('returning answer: %j', answer);
this.setAnswer(answer);
return answer;

@@ -198,3 +206,3 @@ }

// app.hints store, if one exists
if (app.hints && typeof this.default === 'undefined') {
if (typeof this.default === 'undefined' && app.hints) {
this.default = app.hints.get(this.name);

@@ -205,2 +213,3 @@ debug('default:hint %j', util.inspect(this.default));

debug('returning answer: %j', answer);
this.setAnswer(answer);
return answer;

@@ -207,0 +216,0 @@ };

@@ -13,3 +13,3 @@ 'use strict';

require('arr-union', 'union');
require('async');
require('async-each-series', 'eachSeries');
require('define-property', 'define');

@@ -16,0 +16,0 @@ require('get-value', 'get');

{
"name": "question-cache",
"description": "A wrapper around inquirer that makes it easy to create and selectively reuse questions.",
"version": "0.4.0",
"version": "0.5.0",
"homepage": "https://github.com/jonschlinkert/question-cache",

@@ -13,4 +13,7 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"files": [
"LICENSE",
"README.md",
"index.js",
"lib"
"lib",
"utils.js"
],

@@ -24,19 +27,19 @@ "main": "index.js",

"arr-union": "^3.1.0",
"async": "1.5.2",
"async-each-series": "^1.1.0",
"debug": "^2.2.0",
"define-property": "^0.2.5",
"get-value": "^2.0.5",
"get-value": "^2.0.6",
"has-value": "^0.3.1",
"inquirer2": "^0.1.1",
"is-answer": "^0.1.0",
"isobject": "^2.0.0",
"lazy-cache": "^1.0.3",
"isobject": "^2.1.0",
"lazy-cache": "^2.0.1",
"mixin-deep": "^1.1.3",
"omit-empty": "^0.3.6",
"option-cache": "^3.3.5",
"omit-empty": "^0.4.1",
"option-cache": "^3.4.0",
"os-homedir": "^1.0.1",
"project-name": "^0.2.4",
"project-name": "^0.2.5",
"set-value": "^0.3.3",
"to-choices": "^0.2.0",
"use": "^1.1.2"
"use": "^2.0.0"
},

@@ -46,10 +49,10 @@ "devDependencies": {

"ansi-red": "^0.1.1",
"gulp": "^3.9.0",
"gulp-eslint": "^1.0.0",
"gulp-format-md": "^0.1.7",
"gulp-istanbul": "^0.10.2",
"gulp-mocha": "^2.1.3",
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.1",
"gulp-format-md": "^0.1.9",
"gulp-istanbul": "^1.0.0",
"gulp-mocha": "^2.2.0",
"gulp-unused": "^0.1.2",
"helper-example": "^0.1.0",
"mocha": "^2.4.5"
"mocha": "^2.5.3"
},

@@ -59,9 +62,24 @@ "keywords": [

"ask",
"cache",
"cli",
"command",
"command-line",
"console",
"create",
"generate",
"generator",
"generators",
"init",
"inquirer",
"menu",
"project",
"prompt",
"prompts",
"question",
"questions",
"scaffold",
"stdin",
"store",
"terminal",
"tty",
"util",

@@ -92,2 +110,3 @@ "yeoman"

"verb",
"verb-generate-readme",
"yeoman"

@@ -94,0 +113,0 @@ ],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc