mokkabonna / inquirer-autocomplete-prompt

Autocomplete prompt for inquirer
ISC License
350 stars 82 forks source link

Filter is not applied to answer #31

Closed brandonjpierce closed 7 years ago

brandonjpierce commented 7 years ago

filter is not applied to the selected value / answer. To reproduce adjust your example.js file prompts to:

{
  type: 'autocomplete',
  name: 'fruit',
  suggestOnly: true,
  message: 'What is your favorite fruit?',
  source: searchFood,
  pageSize: 4,
  filter: answer => answer.slice(0, 2),
  validate: function(val) {
    return val ? true : 'Type something!';
  },
}, {
  type: 'autocomplete',
  name: 'state',
  message: 'Select a state to travel from',
  source: searchStates,
  filter: answer => answer.slice(0, 2),
},

Notice the values remain unchained.

mokkabonna commented 7 years ago

Thanks for reporting, is fixed in latest release 0.9.0

https://github.com/mokkabonna/inquirer-autocomplete-prompt/commit/59b29e7e060a8aa6599481a907b6fc582e7d5676

mokkabonna commented 7 years ago

Currently only synchronous filter is implemented

brandonjpierce commented 7 years ago

Excellent, thanks so much!

mokkabonna commented 7 years ago

Have now implemented async filter as well. 0.10.0