|
|
@ -415,6 +415,15 @@ function getDotValue (obj, field) { |
|
|
|
function areThingsEqual (a, b) { |
|
|
|
function areThingsEqual (a, b) { |
|
|
|
var aKeys , bKeys , i; |
|
|
|
var aKeys , bKeys , i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// String against regexp
|
|
|
|
|
|
|
|
if (util.isRegExp(b)) { |
|
|
|
|
|
|
|
if (typeof a !== 'string') { |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return b.test(a); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Strings, booleans, numbers, null
|
|
|
|
// Strings, booleans, numbers, null
|
|
|
|
if (a === null || typeof a === 'string' || typeof a === 'boolean' || typeof a === 'number' || |
|
|
|
if (a === null || typeof a === 'string' || typeof a === 'boolean' || typeof a === 'number' || |
|
|
|
b === null || typeof b === 'string' || typeof b === 'boolean' || typeof b === 'number') { return a === b; } |
|
|
|
b === null || typeof b === 'string' || typeof b === 'boolean' || typeof b === 'number') { return a === b; } |
|
|
@ -426,7 +435,7 @@ function areThingsEqual (a, b) { |
|
|
|
// undefined (no match since they mean field doesn't exist and can't be serialized)
|
|
|
|
// undefined (no match since they mean field doesn't exist and can't be serialized)
|
|
|
|
if (util.isArray(a) || util.isArray(b) || a === undefined || b === undefined) { return false; } |
|
|
|
if (util.isArray(a) || util.isArray(b) || a === undefined || b === undefined) { return false; } |
|
|
|
|
|
|
|
|
|
|
|
// Objects (check for deep equality)
|
|
|
|
// General objects (check for deep equality)
|
|
|
|
// a and b should be objects at this point
|
|
|
|
// a and b should be objects at this point
|
|
|
|
try { |
|
|
|
try { |
|
|
|
aKeys = Object.keys(a); |
|
|
|
aKeys = Object.keys(a); |
|
|
@ -609,7 +618,7 @@ function matchQueryPart (obj, queryKey, queryValue) { |
|
|
|
|
|
|
|
|
|
|
|
// queryValue is an actual object. Determine whether it contains comparison operators
|
|
|
|
// queryValue is an actual object. Determine whether it contains comparison operators
|
|
|
|
// or only normal fields. Mixed objects are not allowed
|
|
|
|
// or only normal fields. Mixed objects are not allowed
|
|
|
|
if (queryValue !== null && typeof queryValue === 'object') { |
|
|
|
if (queryValue !== null && typeof queryValue === 'object' && !util.isRegExp(queryValue)) { |
|
|
|
keys = Object.keys(queryValue); |
|
|
|
keys = Object.keys(queryValue); |
|
|
|
firstChars = _.map(keys, function (item) { return item[0]; }); |
|
|
|
firstChars = _.map(keys, function (item) { return item[0]; }); |
|
|
|
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); |
|
|
|
dollarFirstChars = _.filter(firstChars, function (c) { return c === '$'; }); |
|
|
|