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

Function processProperty

resources/buildConfigDefinitions.js:97–146  ·  view source on GitHub ↗
(property, iface)

Source from the content-addressed store, hash-verified

95}
96
97function processProperty(property, iface) {
98 const firstComment = getCommentValue(last(property.leadingComments || []));
99 const name = property.key.name;
100 const prefix = getENVPrefix(iface);
101
102 if (!firstComment) {
103 return;
104 }
105 const lines = firstComment.split('\n').map(line => line.trim());
106 let help = '';
107 let envLine;
108 let defaultLine;
109 lines.forEach(line => {
110 if (line.indexOf(':ENV:') === 0) {
111 envLine = line;
112 } else if (line.indexOf(':DEFAULT:') === 0) {
113 defaultLine = line;
114 } else {
115 help += line;
116 }
117 });
118 let env;
119 if (envLine) {
120 env = envLine.split(' ')[1];
121 } else {
122 env = prefix + toENV(name);
123 }
124 let defaultValue;
125 if (defaultLine) {
126 const defaultArray = defaultLine.split(' ');
127 defaultArray.shift();
128 defaultValue = defaultArray.join(' ');
129 }
130 let type = property.value.type;
131 let isRequired = true;
132 if (type == 'NullableTypeAnnotation') {
133 isRequired = false;
134 type = property.value.typeAnnotation.type;
135 }
136 return {
137 name,
138 env,
139 help,
140 type,
141 defaultValue,
142 types: property.value.types,
143 typeAnnotation: property.value.typeAnnotation,
144 required: isRequired,
145 };
146}
147
148function doInterface(iface) {
149 return iface.body.properties

Callers 1

doInterfaceFunction · 0.85

Calls 4

getCommentValueFunction · 0.85
lastFunction · 0.85
getENVPrefixFunction · 0.85
toENVFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…