MCPcopy Index your code
hub / github.com/parse-community/parse-server / checkKey

Function checkKey

src/cloud-code/Parse.Cloud.js:47–59  ·  view source on GitHub ↗
(key, data, validatorParam)

Source from the content-addressed store, hash-verified

45 return type;
46 };
47 const checkKey = (key, data, validatorParam) => {
48 const parameter = data[key];
49 if (!parameter) {
50 throw `${key} is not a supported parameter for Cloud Function validations.`;
51 }
52 const types = parameter.map(type => getType(type));
53 const type = getType(validatorParam);
54 if (!types.includes(type) && !types.includes('Any')) {
55 throw `Invalid type for Cloud Function validation key ${key}. Expected ${types.join(
56 '|'
57 )}, actual ${type}`;
58 }
59 };
60 for (const key in validator) {
61 checkKey(key, allowedKeys, validator[key]);
62 if (key === 'fields' || key === 'requireUserKeys') {

Callers 1

validateValidatorFunction · 0.85

Calls 1

getTypeFunction · 0.70

Tested by

no test coverage detected