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

Function serializeAsVegaExpression

docs/app/js/sanddance-app.js:4619–4645  ·  view source on GitHub ↗
(bin, firstFieldName, lastFieldName, clause)

Source from the content-addressed store, hash-verified

4617 return `{${nameValues.join()}}`;
4618}
4619function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) {
4620 if (bin.discreteColumn.column.quantitative) {
4621 const low = [
4622 `name:${JSON.stringify(bin.discreteColumn.column.name)}`,
4623 "operator:'>='",
4624 `value:datum[${JSON.stringify(bin.fields[0])}]`
4625 ];
4626 const high = [
4627 "clause:'&&'",
4628 `name:${JSON.stringify(bin.discreteColumn.column.name)}`,
4629 "operator:'<'",
4630 `value:datum[${JSON.stringify(bin.fields[1])}]`
4631 ];
4632 return obj([
4633 `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]`
4634 ], clause);
4635 } else {
4636 const exact = [
4637 `name:${JSON.stringify(bin.discreteColumn.column.name)}`,
4638 "operator:'=='",
4639 `value:datum[${JSON.stringify(bin.fields[0])}]`
4640 ];
4641 return obj([
4642 `expressions:[${obj(exact)}]`
4643 ], clause);
4644 }
4645}
4646
4647},{"@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"6Rqt5":[function(require,module,exports) {
4648var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 1

objFunction · 0.70

Tested by

no test coverage detected