question-cache
Advanced tools
Comparing version 0.6.0 to 0.7.0
13
index.js
@@ -417,2 +417,3 @@ 'use strict'; | ||
var args = [].slice.call(arguments); | ||
var questions = this.buildQueue(queue); | ||
@@ -427,3 +428,3 @@ var answers = this.answers; | ||
var opts = utils.merge({}, self.options, config); | ||
var data = utils.merge({}, self.data, opts); | ||
var data = utils.merge({}, self.data, opts, opts.data); | ||
@@ -494,2 +495,12 @@ var question = self.get(key); | ||
var val = answer[key]; | ||
if (!val && (opts.required || question.required)) { | ||
var msg = question.requiredMessage | ||
|| opts.requiredMessage | ||
|| '>> answer is required'; | ||
console.log(utils.log.red(msg)); | ||
self.ask.apply(self, args); | ||
return; | ||
} | ||
if (question.type === 'checkbox') { | ||
@@ -496,0 +507,0 @@ val = utils.flatten(val); |
@@ -163,3 +163,3 @@ /*! | ||
Question.prototype.getAnswer = function(answers, data) { | ||
return utils.get(answers, this.name) || utils.get(data, this.name); | ||
return utils.get(data, this.name) || utils.get(answers, this.name); | ||
}; | ||
@@ -166,0 +166,0 @@ |
@@ -22,2 +22,3 @@ 'use strict'; | ||
require('isobject', 'isObject'); | ||
require('log-utils', 'log'); | ||
require('mixin-deep', 'merge'); | ||
@@ -24,0 +25,0 @@ require('omit-empty'); |
{ | ||
"name": "question-cache", | ||
"description": "A wrapper around inquirer that makes it easy to create and selectively reuse questions.", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"homepage": "https://github.com/jonschlinkert/question-cache", | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"contributors": [ | ||
"Brian Woodward <brian.woodward@gmail.com> (https://github.com/doowb)", | ||
"Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)" | ||
], | ||
"repository": "jonschlinkert/question-cache", | ||
@@ -14,5 +18,3 @@ "bugs": { | ||
"index.js", | ||
"lib", | ||
"LICENSE", | ||
"README.md" | ||
"lib" | ||
], | ||
@@ -37,2 +39,3 @@ "main": "index.js", | ||
"lazy-cache": "^2.0.1", | ||
"log-utils": "^0.2.1", | ||
"mixin-deep": "^1.1.3", | ||
@@ -39,0 +42,0 @@ "omit-empty": "^0.4.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39225
783
21
+ Addedlog-utils@^0.2.1
+ Addedansi-bgblack@0.1.1(transitive)
+ Addedansi-bgblue@0.1.1(transitive)
+ Addedansi-bgcyan@0.1.1(transitive)
+ Addedansi-bggreen@0.1.1(transitive)
+ Addedansi-bgmagenta@0.1.1(transitive)
+ Addedansi-bgred@0.1.1(transitive)
+ Addedansi-bgwhite@0.1.1(transitive)
+ Addedansi-bgyellow@0.1.1(transitive)
+ Addedansi-black@0.1.1(transitive)
+ Addedansi-blue@0.1.1(transitive)
+ Addedansi-bold@0.1.1(transitive)
+ Addedansi-colors@0.2.0(transitive)
+ Addedansi-cyan@0.1.1(transitive)
+ Addedansi-dim@0.1.1(transitive)
+ Addedansi-green@0.1.1(transitive)
+ Addedansi-grey@0.1.1(transitive)
+ Addedansi-hidden@0.1.1(transitive)
+ Addedansi-inverse@0.1.1(transitive)
+ Addedansi-italic@0.1.1(transitive)
+ Addedansi-magenta@0.1.1(transitive)
+ Addedansi-red@0.1.1(transitive)
+ Addedansi-reset@0.1.1(transitive)
+ Addedansi-strikethrough@0.1.1(transitive)
+ Addedansi-underline@0.1.1(transitive)
+ Addedansi-white@0.1.1(transitive)
+ Addedansi-yellow@0.1.1(transitive)
+ Addederror-symbol@0.1.0(transitive)
+ Addedinfo-symbol@0.1.0(transitive)
+ Addedlog-ok@0.1.1(transitive)
+ Addedlog-utils@0.2.1(transitive)
+ Addedsuccess-symbol@0.1.0(transitive)
+ Addedtime-stamp@1.1.0(transitive)
+ Addedwarning-symbol@0.1.0(transitive)