Skip to content

Commit 260c466

Browse files
acinaderflovilmart
authored andcommitted
Change name of function and variable from baseFieldName to rootFieldName (#4817)
1 parent e064716 commit 260c466

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Controllers/DatabaseController.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ const untransformObjectACL = ({_rperm, _wperm, ...output}) => {
295295
}
296296

297297
/**
298-
* When querying, the fieldName may be compound, extract the base fieldName
298+
* When querying, the fieldName may be compound, extract the root fieldName
299299
* `temperature.celsius` becomes `temperature`
300300
* @param {string} fieldName that may be a compound field name
301-
* @returns {string} the basename of the field
301+
* @returns {string} the root name of the field
302302
*/
303-
const getBaseFieldName = (fieldName: string): string => {
303+
const getRootFieldName = (fieldName: string): string => {
304304
return fieldName.split('.')[0]
305305
}
306306

@@ -421,8 +421,8 @@ class DatabaseController {
421421
if (fieldName.match(/^authData\.([a-zA-Z0-9_]+)\.id$/)) {
422422
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name for update: ${fieldName}`);
423423
}
424-
const baseFieldName = getBaseFieldName(fieldName);
425-
if (!SchemaController.fieldNameIsValid(baseFieldName) && !isSpecialUpdateKey(baseFieldName)) {
424+
const rootFieldName = getRootFieldName(fieldName);
425+
if (!SchemaController.fieldNameIsValid(rootFieldName) && !isSpecialUpdateKey(rootFieldName)) {
426426
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name for update: ${fieldName}`);
427427
}
428428
});
@@ -910,8 +910,8 @@ class DatabaseController {
910910
if (fieldName.match(/^authData\.([a-zA-Z0-9_]+)\.id$/)) {
911911
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Cannot sort by ${fieldName}`);
912912
}
913-
const baseFieldName = getBaseFieldName(fieldName);
914-
if (!SchemaController.fieldNameIsValid(baseFieldName)) {
913+
const rootFieldName = getRootFieldName(fieldName);
914+
if (!SchemaController.fieldNameIsValid(rootFieldName)) {
915915
throw new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Invalid field name: ${fieldName}.`);
916916
}
917917
});

0 commit comments

Comments
 (0)