Skip to content

Commit

Permalink
changed autocomplete limit to ensure correct sort
Browse files Browse the repository at this point in the history
  • Loading branch information
acburst committed Jun 1, 2019
1 parent a7dd622 commit e6395fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@
// Gather all matching data
for (let key in data) {
if (data.hasOwnProperty(key) && key.toLowerCase().indexOf(val) !== -1) {
// Break if past limit
if (this.count >= this.options.limit) {
break;
}

let entry = {
data: data[key],
key: key
Expand All @@ -376,6 +371,9 @@
matchingData.sort(sortFunctionBound);
}

// Limit
matchingData = matchingData.slice(0, this.options.limit);

// Render
for (let i = 0; i < matchingData.length; i++) {
let entry = matchingData[i];
Expand Down

0 comments on commit e6395fa

Please sign in to comment.