Skip to content

Commit

Permalink
Turns out jQuery's map is the correct one to use.
Browse files Browse the repository at this point in the history
  • Loading branch information
Happy0 committed Sep 27, 2016
1 parent bcea586 commit 0db550e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/javascripts/forum-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ $(function () {
};

var searchCandidates = function(term, candidateUsers) {
return candidateUsers.map(function (user) {
// We use jQuery's map because returning 'null' removes it from the list.
// This follows jquery-autocomplete's semantics.
return $.map(candidateUsers, function (user) {
return user.indexOf(term) === 0 ? user : null;
});
};
Expand Down

0 comments on commit 0db550e

Please sign in to comment.