Skip to content

Commit

Permalink
Allow more advanced sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Nov 18, 2015
1 parent 6b4026e commit b85ba52
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions awesomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,16 @@ _.prototype = {
// Populate list with options that match
this.ul.innerHTML = "";

this._list
var filtered = this._list
.filter(function(item) {
return me.filter(item, value);
})
.sort(this.sort)

var sorted = this.sort.length === 1
? this.sort(filtered)
: filtered.sort(this.sort);

sorted
.every(function(text, i) {
me.ul.appendChild(me.item(text, value));

Expand Down

0 comments on commit b85ba52

Please sign in to comment.