MCPcopy Create free account
hub / github.com/corbanbrook/dsp.js / transformVarDefinition

Function transformVarDefinition

examples/js/processing.js:11456–11470  ·  view source on GitHub ↗
(def, defaultTypeValue)

Source from the content-addressed store, hash-verified

11454 };
11455
11456 function transformVarDefinition(def, defaultTypeValue) {
11457 var eqIndex = def.indexOf("=");
11458 var name, value, isDefault;
11459 if(eqIndex < 0) {
11460 name = def;
11461 value = defaultTypeValue;
11462 isDefault = true;
11463 } else {
11464 name = def.substring(0, eqIndex);
11465 value = transformExpression(def.substring(eqIndex + 1));
11466 isDefault = false;
11467 }
11468 return new AstVarDefinition( trim(name.replace(/(\s*"C\d+")+/g, "")),
11469 value, isDefault);
11470 }
11471
11472 function getDefaultValueForType(type) {
11473 if(type === "int" || type === "float") {

Callers 2

transformStatementFunction · 0.85
transformClassFieldFunction · 0.85

Calls 1

trimFunction · 0.85

Tested by

no test coverage detected