Fix "get_key_index" to fit caller's expectations

The clients of "get_key_index" expect index of key in matching case
otherwise -1. But instead of this function returns the "undefined"
value.

Fixes: https://pagure.io/freeipa/issue/7678
Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
Stanislav Levin 2018-08-22 22:36:24 +03:00 committed by Serhii Tsymbaliuk
parent 6175672e8e
commit c3f23da49d

View File

@ -125,7 +125,11 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function(map) {
};
that.get_key_index = function(key) {
return that._key_indicies[key];
var index = that._key_indicies[key];
if (index !== undefined) {
return index;
}
return -1;
};
that.get_key_by_index = function(index) {