function matchesQuery(object: any, query: any): boolean {
  if (query instanceof Parse.Query) {
    var className = object.id instanceof Id ? object.id.className : object.className;
    if (className !== query.className) {
      return false;
    }
    return matchesQuery(object, query._where);
  }
  for (var field in query) {
    if (!matchesKeyConstraints(object, field, query[field])) {
      return false;
    }
  }
  return true;
}
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.