Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Add support for minMatchingChars=0 #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/components/VueBootstrapTypeaheadList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default {
},

matchedItems() {
// If no query, but minMatchingChars is 0: return trimmed data. filter and sort are not applicable as there is no query string.
// simple falsey check should cover 0 length string, null, undefined.
if (this.minMatchingChars === 0 && !this.query) return this.data.slice(0, this.maxMatches)

if (this.query.length === 0 || this.query.length < this.minMatchingChars) {
return []
}
Expand Down