@@ -169,19 +169,17 @@ function transformQueryKeyValue(schema, className, key, value, { validate } = {}
169
169
if ( ! ( value instanceof Array ) ) {
170
170
throw new Parse . Error ( Parse . Error . INVALID_QUERY , 'bad $or format - use an array value' ) ;
171
171
}
172
- var mongoSubqueries = value . map ( subQuery => transformWhere ( schema , className , subQuery ) ) ;
173
- return { key : '$or' , value : mongoSubqueries } ;
172
+ return { key : '$or' , value : value . map ( subQuery => transformWhere ( schema , className , subQuery ) ) } ;
174
173
case '$and' :
175
174
if ( ! ( value instanceof Array ) ) {
176
175
throw new Parse . Error ( Parse . Error . INVALID_QUERY , 'bad $and format - use an array value' ) ;
177
176
}
178
- var mongoSubqueries = value . map ( subQuery => transformWhere ( schema , className , subQuery ) ) ;
179
- return { key : '$and' , value : mongoSubqueries } ;
177
+ return { key : '$and' , value : value . map ( subQuery => transformWhere ( schema , className , subQuery ) ) } ;
180
178
default :
181
179
// Other auth data
182
- var authDataMatch = key . match ( / ^ a u t h D a t a \. ( [ a - z A - Z 0 - 9 _ ] + ) \. i d $ / ) ;
180
+ const authDataMatch = key . match ( / ^ a u t h D a t a \. ( [ a - z A - Z 0 - 9 _ ] + ) \. i d $ / ) ;
183
181
if ( authDataMatch ) {
184
- var provider = authDataMatch [ 1 ] ;
182
+ const provider = authDataMatch [ 1 ] ;
185
183
// Special-case auth data.
186
184
return { key : `_auth_data_${ provider } .id` , value} ;
187
185
}
@@ -193,15 +191,15 @@ function transformQueryKeyValue(schema, className, key, value, { validate } = {}
193
191
// Handle special schema key changes
194
192
// TODO: it seems like this is likely to have edge cases where
195
193
// pointer types are missed
196
- var expected = undefined ;
194
+ let expected = undefined ;
197
195
if ( schema && schema . getExpectedType ) {
198
196
expected = schema . getExpectedType ( className , key ) ;
199
197
}
200
198
if ( ( expected && expected . type == 'Pointer' ) ||
201
199
( ! expected && value && value . __type == 'Pointer' ) ) {
202
200
key = '_p_' + key ;
203
201
}
204
- var expectedTypeIsArray = ( expected && expected . type === 'Array' ) ;
202
+ const expectedTypeIsArray = ( expected && expected . type === 'Array' ) ;
205
203
206
204
// Handle query constraints
207
205
if ( transformConstraint ( value , expectedTypeIsArray ) !== CannotTransform ) {
0 commit comments