Does inquirer.js currently have an api for continuously prompting the user?
For example, something like:
What are your favorite animals? (Leave empty when done) cats
What are your favorite animals? (Leave empty when done) dogs
What are your favorite animals? (Leave empty when done) lions
What are your favorite animals? (Leave empty when done)
...
And then the promise would return an array of answers, or in this case: ['cats', 'dogs', 'lions']
No, but you can use recursion to do the same thing by yourself. No need for an API, just use JavaScript :)
You can do something just like this @mechanical-turk
I know that is closed but may this will help him
function myFunction(callback) {
prompt(questions).then(answ => {
usersList.push({
name: answ.userName,
value: answ.userValue
});
if ( /* repeat condition */ ) {
myFunction(() => {
callback();
});
} else {
callback()
}
})
}
@Rawnly thanks mate
Most helpful comment
You can do something just like this @mechanical-turk