diff --git a/lib/model.js b/lib/model.js index e25c42b..905a9e3 100644 --- a/lib/model.js +++ b/lib/model.js @@ -287,7 +287,10 @@ function areThingsEqual (a, b) { } -comparisonFunctions.$lt = function (a, b) { +/** + * Check that two values are comparable + */ +function areComparable (a, b) { if (typeof a !== 'string' && typeof a !== 'number' && !util.isDate(a) && typeof b !== 'string' && typeof b !== 'number' && !util.isDate(b)) { return false; @@ -295,7 +298,12 @@ comparisonFunctions.$lt = function (a, b) { if (typeof a !== typeof b) { return false; } - return a < b; + return true; +} + + +comparisonFunctions.$lt = function (a, b) { + return areComparable(a, b) && a < b; };