MCPcopy Create free account
hub / github.com/parse-community/parse-server / validateKeyNames

Method validateKeyNames

src/ParseServer.ts:92–115  ·  view source on GitHub ↗
(original, ref, name = '')

Source from the content-addressed store, hash-verified

90 const optionsBlueprint = getValidObject(interfaces['ParseServerOptions']);
91
92 function validateKeyNames(original, ref, name = '') {
93 let result = [];
94 const prefix = name + (name !== '' ? '.' : '');
95 for (const key in original) {
96 if (!Object.prototype.hasOwnProperty.call(ref, key)) {
97 result.push(prefix + key);
98 } else {
99 if (ref[key] === '') { continue; }
100 let res = [];
101 if (Array.isArray(original[key]) && Array.isArray(ref[key])) {
102 const type = ref[key][0];
103 original[key].forEach((item, idx) => {
104 if (typeof item === 'object' && item !== null) {
105 res = res.concat(validateKeyNames(item, type, prefix + key + `[${idx}]`));
106 }
107 });
108 } else if (typeof original[key] === 'object' && typeof ref[key] === 'object') {
109 res = validateKeyNames(original[key], ref[key], prefix + key);
110 }
111 result = result.concat(res);
112 }
113 }
114 return result;
115 }
116
117 const diff = validateKeyNames(options, optionsBlueprint);
118 if (diff.length > 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected