Skip to content

Commit cae901f

Browse files
pawelczakpawelczak
authored andcommitted
Closes #74. Test for matchResponseProperty - function
1 parent cdfff9f commit cae901f

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

dist/jquery.easy-autocomplete.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,14 +1079,16 @@ var EasyAutocomplete = (function(scope) {
10791079

10801080
function checkInputPhraseMatchResponse(inputPhrase, data) {
10811081

1082-
if (config.get("matchResponseProperty") !== false || typeof config.get("matchResponseProperty") === "string") {
1082+
if (config.get("matchResponseProperty") !== false) {
1083+
if (typeof config.get("matchResponseProperty") === "string") {
1084+
return (data[config.get("matchResponseProperty")] == inputPhrase);
1085+
}
10831086

1084-
if (data[config.get("matchResponseProperty")] == inputPhrase) {
1085-
return true;
1086-
} else {
1087-
return false;
1087+
if (typeof config.get("matchResponseProperty") === "function") {
1088+
return (config.get("matchResponseProperty")(data) === inputPhrase);
10881089
}
10891090

1091+
return true;
10901092
} else {
10911093
return true;
10921094
}

0 commit comments

Comments
 (0)