Comparing version 0.8.2 to 0.8.3
@@ -28,2 +28,5 @@ /** | ||
if ( val.type === "separator" ) { | ||
if(!(val instanceof Separator)){ | ||
val = new Separator(val.line); | ||
} | ||
return val; | ||
@@ -30,0 +33,0 @@ } |
@@ -114,12 +114,21 @@ /** | ||
PromptUI.prototype.filterIfRunnable = function( question ) { | ||
if ( !_.isFunction(question.when) ) return rx.Observable.return(question); | ||
if ( question.when == null ) return rx.Observable.return(question); | ||
var handleResult = function( obs, shouldRun ) { | ||
if ( shouldRun ) { | ||
obs.onNext( question ); | ||
} | ||
obs.onCompleted(); | ||
}; | ||
var answers = this.answers; | ||
return rx.Observable.defer(function() { | ||
return rx.Observable.create(function( obs ) { | ||
if ( _.isBoolean(question.when) ) { | ||
handleResult( obs, question.when ); | ||
return; | ||
} | ||
utils.runAsync( question.when, function( shouldRun ) { | ||
if ( shouldRun ) { | ||
obs.onNext( question ); | ||
} | ||
obs.onCompleted(); | ||
handleResult( obs, shouldRun ); | ||
}, answers ); | ||
@@ -126,0 +135,0 @@ }); |
{ | ||
"name": "inquirer", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"description": "A collection of common interactive command line user interfaces.", | ||
@@ -5,0 +5,0 @@ "main": "lib/inquirer.js", |
@@ -68,3 +68,3 @@ Inquirer.js | ||
- **filter**: (Function) Receive the user input and return the filtered value to be used inside the program. The value returned will be added to the _Answers_ hash. | ||
- **when**: (Function) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked. | ||
- **when**: (Function, Boolean) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked. The value can also be a simple boolean. | ||
@@ -71,0 +71,0 @@ `default`(if defined as a function), `validate`, `filter` and `when` functions can be called asynchronously using `this.async()`. You just have to pass the value you'd normally return to the callback option. |
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
65691
1840