MCPcopy Create free account
hub / github.com/microsoft/SandDance / parseSubParameter

Function parseSubParameter

docs/app/js/sanddance-app.js:148134–148148  ·  view source on GitHub ↗

* Parse a sub-parameter object.

(def, value15, scope)

Source from the content-addressed store, hash-verified

148132/**
148133 * Parse a sub-parameter object.
148134 */ function parseSubParameter(def, value15, scope) {
148135 const n = def.params.length;
148136 let pdef; // loop over defs to find matching key
148137 for(let i = 0; i < n; ++i){
148138 pdef = def.params[i];
148139 for(const k in pdef.key)if (pdef.key[k] !== value15[k]) {
148140 pdef = null;
148141 break;
148142 }
148143 if (pdef) break;
148144 } // raise error if matching key not found
148145 if (!pdef) (0, _vegaUtil.error)("Unsupported parameter: " + (0, _vegaUtil.stringValue)(value15)); // parse params, create Params transform, return ref
148146 const params = (0, _vegaUtil.extend)(parseParameters(pdef, value15, scope), pdef.key);
148147 return ref(scope.add(Params(params)));
148148} // -- Utilities -----
148149const outerExpr = (_)=>_ && _.expr;
148150const outerField = (_)=>_ && _.field;
148151const isData = (_)=>_ === "data";

Callers 1

parseSubParametersFunction · 0.70

Calls 4

parseParametersFunction · 0.70
refFunction · 0.70
ParamsFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected