Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
create() {
var csvString = `,2,3
4,5,6
7,8,9`;
var data = Papa.parse(csvString, {
dynamicTyping: true
});
console.log(data); // a 3x3 array
csvString = `name,hp,mp
4,5,6
7,8,9`;
data = Papa.parse(csvString, {
dynamicTyping: true,
header: true
});
console.log(data); // an object array with 2 rows
}
create() {
var csvString = `,2,3
4,5,6
7,8,9`;
var data = Papa.parse(csvString, {
dynamicTyping: true
});
console.log(data); // a 3x3 array
csvString = `name,hp,mp
4,5,6
7,8,9`;
data = Papa.parse(csvString, {
dynamicTyping: true,
header: true
});
console.log(data); // an object array with 2 rows
}
create() {
var csvString = `name,hp,mp
Rex,100,20
Alice,300,40`;
var csvTable = Papa.parse(csvString, {
dynamicTyping: true,
header: true
}).data;
// Create the database
var db = new loki();
// Create a collection
var children = db.addCollection('children');
// insert csv-table
children.insert(csvTable);
var result = children.chain().data();
console.log(result);
}
handleFileSelect(evt) {
const file = evt.target.files[0];
Papa.parse(file, {
complete: (results) => {
this.setState({data: results.data, headerRow: results.data[0]});
},
});
}
}
if (dataSize.value === 'medium') {
this.setState({
dataSize: dataSize.value,
data: data.mediumData,
headerRow: data.mediumData[0],
isLoaded: true,
selectedAggregationDimension: 'Quantity',
});
}
if (dataSize.value === 'large') {
this.setState({
dataSize: dataSize.value,
isLoaded: false,
});
Papa.parse('https://raw.githubusercontent.com/turnerniles/' +
'react-virtualized-pivot/master/src/sampledata/RejectStatsA.csv', {
download: true,
complete: (results) => {
this.setState({
data: results.data,
headerRow: results.data[0],
selectedAggregationDimension: 'Amount Requested',
isLoaded: true,
});
},
});
}
}