Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe(`${item.prototype.constructor.name}`, () => {
if (item.prototype instanceof Class) {
classDef("other", item);
}
if (item.prototype instanceof HTMLWidget || item.prototype instanceof SVGWidget || item.prototype instanceof CanvasWidget) {
switch (item.prototype.constructor) {
case HeatMap:
render(new HeatMap()
.columns(data.HeatMap.simple.columns)
.data(data.HeatMap.simple.data)
);
break;
case Table:
const table = new Table()
.columns(["Subject", "Year 1", "Year 2", "Year 3", "Year 4"])
.data([
["Width 2 undefined", , 83, , 72],
["English II", 17, 43, 83, 93],
["English III", 6, 43, 64, 93],
["Width Blank", 7, "", 52, 83],
["Geography II", 16, 73, 52, 83],
["Width 2 undefined", , 83, , 72],
["Science", 66, 60, 85, 6],
["Science II", 46, 20, 53, 7],
["With 2 NULL", null, 20, null, 7],
["Math", 98, 30, 23, 13],
["Math II", 76, 30, 34, 6],
["Math III", 80, 30, 27, 8]
])
;
case "dataset":
const columns = [];
const columnsIdx = {};
const data2 = cell.map(function (row2, idx) {
const retVal2 = [];
retVal2.length = columns.length;
for (const key in row2) {
if (idx === 0) {
columnsIdx[key] = columns.length;
columns.push(key);
}
retVal2[columnsIdx[key]] = row2[key];
}
return retVal2;
});
const table = new Table()
.columns(columns)
.data(data2)
;
row[colIdx] = table;
break;
case "widget":
const viz = this.visualization.vizDeclarations[field.localVisualizationID()];
const output = viz.source.getOutput();
const db = output.db;
output.setData(cell, []);
const widget = viz.widget;
const newWidget = new widget.constructor()
.showToolbar(false)
.chartType(widget.chartType())
.chartTypeDefaults(widget.chartTypeDefaults())
.columns(viz.source.getColumns())