MCPcopy
hub / github.com/google/earthengine-api / decode

Function decode

javascript/src/deserializer.js:269–293  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

267 };
268
269 const decode = (node) => {
270 if (node.constantValue !== null) {
271 return node.constantValue;
272 } else if (node.arrayValue !== null) {
273 return node.arrayValue.values.map(decode);
274 } else if (node.dictionaryValue !== null) {
275 return goog.object.map(node.dictionaryValue.values, decode);
276 } else if (node.argumentReference !== null) {
277 return ee.CustomFunction.variable(Object, node.argumentReference);
278 } else if (node.functionDefinitionValue !== null) {
279 return decodeFunctionDefinition(node.functionDefinitionValue);
280 } else if (node.functionInvocationValue !== null) {
281 return decodeFunctionInvocation(node.functionInvocationValue);
282 } else if (node.bytesValue !== null) {
283 return ee.Deserializer.roundTrip_(
284 new ee.api.ValueNode({bytesValue: node.bytesValue}), node.bytesValue);
285 } else if (node.integerValue !== null) {
286 return ee.Deserializer.roundTrip_(
287 new ee.api.ValueNode({integerValue: node.integerValue}),
288 node.integerValue);
289 } else if (node.valueReference !== null) {
290 return lookup(node.valueReference, 'reference');
291 }
292 return null; // From the null constantValue
293 };
294
295 const decodeFunctionDefinition = (defined) => {
296 const body = lookup(defined.body, 'function body');

Callers 1

lookupFunction · 0.70

Calls 5

decodeFunctionDefinitionFunction · 0.85
decodeFunctionInvocationFunction · 0.85
variableMethod · 0.80
lookupFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected