Remove unnecessary logic

This commit is contained in:
Drew Gross
2016-04-25 18:48:22 -07:00
parent e0a9f19895
commit 5c7b346292

View File

@@ -130,12 +130,7 @@ function transformKeyValue(schema, className, restKey, restValue, {
return {key: key, value: value};
}
function transformQueryKeyValue(schema, className, restKey, restValue, {
inArray,
inObject,
update,
validate,
} = {}) {
function transformQueryKeyValue(schema, className, restKey, restValue, { validate } = {}) {
// Check if the schema is known since it's a built-in field.
var key = restKey;
var timeField = false;
@@ -228,7 +223,7 @@ function transformQueryKeyValue(schema, className, restKey, restValue, {
}
// Handle atomic values
var value = transformAtom(restValue, false, { inArray, inObject });
var value = transformAtom(restValue, false);
if (value !== CannotTransform) {
if (timeField && (typeof value === 'string')) {
value = new Date(value);
@@ -236,19 +231,13 @@ function transformQueryKeyValue(schema, className, restKey, restValue, {
return {key: key, value: value};
}
// ACLs are handled before this method is called
// If an ACL key still exists here, something is wrong.
if (key === 'ACL') {
throw 'There was a problem transforming an ACL.';
}
// Handle arrays
if (restValue instanceof Array) {
throw new Parse.Error(Parse.Error.INVALID_JSON,'cannot use array as query param');
}
// Handle update operators
value = transformUpdateOperator(restValue, !update);
value = transformUpdateOperator(restValue, true);
if (value !== CannotTransform) {
return {key: key, value: value};
}