You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your example you have the following for the thirdQuestion:
choices: answers => index => {
switch (index) {
case 0:
return ['second line when selected first', 'third line when selected first'];
case 1:
return ['first line when selected second', 'third line when selected second'];
case 2:
return ['first line when selected third', 'second line when selected third'];
default:
return ['first line', 'second line'];
}
},
choices: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
So in your example I understand using the short-form arrow (=>) is used to declare a function that takes an answers parameter, however I don't understand the second arrow (=>index). To me this almost looks as if it's a short-form for apply on an array?
The text was updated successfully, but these errors were encountered:
In your example you have the following for the
thirdQuestion
:The inquirer documentation for the
choices
property of a question states:So in your example I understand using the short-form arrow (
=>
) is used to declare a function that takes ananswers
parameter, however I don't understand the second arrow (=>index
). To me this almost looks as if it's a short-form forapply
on an array?The text was updated successfully, but these errors were encountered: