Skip to content

Commit

Permalink
Closes #74. Test for matchResponseProperty - function
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelczak authored and pawelczak committed Sep 19, 2015
1 parent cdfff9f commit cae901f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
12 changes: 7 additions & 5 deletions dist/jquery.easy-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,14 +1079,16 @@ var EasyAutocomplete = (function(scope) {

function checkInputPhraseMatchResponse(inputPhrase, data) {

if (config.get("matchResponseProperty") !== false || typeof config.get("matchResponseProperty") === "string") {
if (config.get("matchResponseProperty") !== false) {
if (typeof config.get("matchResponseProperty") === "string") {
return (data[config.get("matchResponseProperty")] == inputPhrase);
}

if (data[config.get("matchResponseProperty")] == inputPhrase) {
return true;
} else {
return false;
if (typeof config.get("matchResponseProperty") === "function") {
return (config.get("matchResponseProperty")(data) === inputPhrase);
}

return true;
} else {
return true;
}
Expand Down
Loading

0 comments on commit cae901f

Please sign in to comment.