MCPcopy Index your code
hub / github.com/microsoft/SandDance / parseData$1

Function parseData$1

docs/app/js/sanddance-app.js:148155–148183  ·  view source on GitHub ↗
(from, group, scope)

Source from the content-addressed store, hash-verified

148153const isField = (_)=>_ === "field";
148154const isCompare = (_)=>_ === "compare";
148155function parseData$1(from, group, scope) {
148156 let facet, key, op, dataRef, parent; // if no source data, generate singleton datum
148157 if (!from) dataRef = ref(scope.add(Collect(null, [
148158 {}
148159 ])));
148160 else if (facet = from.facet) {
148161 if (!group) (0, _vegaUtil.error)("Only group marks can be faceted."); // use pre-faceted source data, if available
148162 if (facet.field != null) dataRef = parent = getDataRef(facet, scope);
148163 else {
148164 // generate facet aggregates if no direct data specification
148165 if (!from.data) {
148166 op = parseTransform((0, _vegaUtil.extend)({
148167 type: "aggregate",
148168 groupby: (0, _vegaUtil.array)(facet.groupby)
148169 }, facet.aggregate), scope);
148170 op.params.key = scope.keyRef(facet.groupby);
148171 op.params.pulse = getDataRef(facet, scope);
148172 dataRef = parent = ref(scope.add(op));
148173 } else parent = ref(scope.getData(from.data).aggregate);
148174 key = scope.keyRef(facet.groupby, true);
148175 }
148176 } // if not yet defined, get source data reference
148177 if (!dataRef) dataRef = getDataRef(from, scope);
148178 return {
148179 key: key,
148180 pulse: dataRef,
148181 parent: parent
148182 };
148183}
148184function getDataRef(from, scope) {
148185 return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output);
148186}

Callers 1

parseMarkFunction · 0.70

Calls 5

refFunction · 0.70
CollectFunction · 0.70
getDataRefFunction · 0.70
parseTransformFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected