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

Function addSortField

docs/app/js/sanddance-app.js:148212–148234  ·  view source on GitHub ↗
(scope, p, sort)

Source from the content-addressed store, hash-verified

148210 return (0, _vegaUtil.isString)(field4) ? field4 : null;
148211}
148212function addSortField(scope, p, sort) {
148213 const as = aggrField(sort.op, sort.field);
148214 let s;
148215 if (p.ops) for(let i = 0, n = p.as.length; i < n; ++i){
148216 if (p.as[i] === as) return;
148217 }
148218 else {
148219 p.ops = [
148220 "count"
148221 ];
148222 p.fields = [
148223 null
148224 ];
148225 p.as = [
148226 "count"
148227 ];
148228 }
148229 if (sort.op) {
148230 p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op);
148231 p.fields.push(scope.fieldRef(sort.field));
148232 p.as.push(as);
148233 }
148234}
148235function cache(scope, ds, name, optype, field5, counts, index) {
148236 const cache1 = ds[name] || (ds[name] = {}), sort = sortKey(counts);
148237 let k = fieldKey(field5), v, op;

Callers 1

countsRefFunction · 0.70

Calls 1

aggrFieldFunction · 0.70

Tested by

no test coverage detected