MCPcopy Index your code
hub / github.com/google/earthengine-api / countNode

Function countNode

javascript/src/customfunction.js:220–232  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

218 const countNodes = (nodes) =>
219 nodes.map(countNode).reduce((a, b) => a + b, 0);
220 const countNode = (node) => {
221 if (node.functionDefinitionValue) {
222 return 1;
223 } else if (node.arrayValue) {
224 return countNodes(node.arrayValue.values);
225 } else if (node.dictionaryValue) {
226 return countNodes(Object.values(node.dictionaryValue.values));
227 } else if (node.functionInvocationValue) {
228 const fn = node.functionInvocationValue;
229 return countNodes(Object.values(fn.arguments));
230 }
231 return 0;
232 };
233 return countNodes(Object.values(expression.values));
234 };
235

Callers

nothing calls this directly

Calls 2

countNodesFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected