* matchesQuery -- Determines if an object would be returned by a Parse Query * It's a lightweight, where-clause only implementation of a full query engine. * Since we find queries that match objects, rather than objects that match * queries, we can avoid building a full-blown query tool.
(object: any, query: any)
| 169 | * queries, we can avoid building a full-blown query tool. |
| 170 | */ |
| 171 | function matchesQuery(object: any, query: any): boolean { |
| 172 | if (query instanceof Parse.Query) { |
| 173 | var className = object.id instanceof Id ? object.id.className : object.className; |
| 174 | if (className !== query.className) { |
| 175 | return false; |
| 176 | } |
| 177 | return matchesQuery(object, query._where); |
| 178 | } |
| 179 | for (var field in query) { |
| 180 | if (!matchesKeyConstraints(object, field, query[field])) { |
| 181 | return false; |
| 182 | } |
| 183 | } |
| 184 | return true; |
| 185 | } |
| 186 | |
| 187 | function equalObjectsGeneric(obj, compareTo, eqlFn) { |
| 188 | if (Array.isArray(obj)) { |
no test coverage detected