Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.loader.load(this.item.downloadUrl()).then((data) => {
data = read(data, options);
let columns = Object.keys(data[0]);
const types = inferTypes(data, columns);
data.__types__ = types;
// Vega has issues with empty-string fields and fields with dots, so rename those.
let rename = [];
_.each(data.__types__, (value, key) => {
if (key === '') {
rename.push({from: '', to: 'id'});
} else if (key.indexOf('.') >= 0) {
rename.push({from: key, to: key.replace(/\./g, '_')});
}
});
_.each(rename, (d) => {
data.__types__[d.to] = data.__types__[d.from];
delete data.__types__[d.from];
_.each(data, (row) => {