Commit f3e3a9f0 authored by Marco Mariani's avatar Marco Mariani

pass wildcard_character to .cmp()

parent 1f88c5ad
...@@ -145,7 +145,7 @@ property, that behaves like the ``compareFunction`` described in ...@@ -145,7 +145,7 @@ property, that behaves like the ``compareFunction`` described in
... ...
return { return {
... ...
'cmp': function (b) { 'cmp': function (b, wildcard_character) {
if (a < b) { if (a < b) {
return -1; return -1;
} }
...@@ -161,6 +161,7 @@ property, that behaves like the ``compareFunction`` described in ...@@ -161,6 +161,7 @@ property, that behaves like the ``compareFunction`` described in
cast_to: myType cast_to: myType
... ...
``wildcard_character`` is only passed by ``=`` and ``!=`` operators.
If the < or > comparison makes no sense for the objects, the function should return ``undefined``. If the < or > comparison makes no sense for the objects, the function should return ``undefined``.
......
...@@ -205,7 +205,7 @@ SimpleQuery.prototype["="] = function (object_value, comparison_value, ...@@ -205,7 +205,7 @@ SimpleQuery.prototype["="] = function (object_value, comparison_value,
return false; return false;
} }
if (value.cmp !== undefined) { if (value.cmp !== undefined) {
return value.cmp(comparison_value) === 0; return value.cmp(comparison_value, wildcard_character) === 0;
} }
if ( if (
convertStringToRegExp( convertStringToRegExp(
...@@ -249,7 +249,7 @@ SimpleQuery.prototype["!="] = function (object_value, comparison_value, ...@@ -249,7 +249,7 @@ SimpleQuery.prototype["!="] = function (object_value, comparison_value,
return true; return true;
} }
if (value.cmp !== undefined) { if (value.cmp !== undefined) {
return value.cmp(comparison_value) !== 0; return value.cmp(comparison_value, wildcard_character) !== 0;
} }
if ( if (
convertStringToRegExp( convertStringToRegExp(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment