I've been attempting to filter out specific attributes from an array using D3. The array consists of values from a CSV file.
Everything went smoothly for a small CSV file when I did it like this:
d3.csv("foods.csv", function(data) {
data.forEach(function(v){ delete v.name });
data.forEach(function(v){ delete v.created_at });
});
This is how the first array appeared:
However, when I tried to apply the same concept to a larger CSV file, I encountered an error message stating: "DevTools was disconnected from the page. Once the page is reloaded, DevTools will automatically reconnect." This is what the second array looked like. https://i.sstatic.net/RbGvF.png
Why isn't this method working for the second array? Could it be due to the size of the array, or should I attempt to address the values recursively? I already tried implementing it in the following manner:
function deleteCitation(v) {
if(Object.prototype.toString.call(v) === '[object Array]' ) {
v.forEach(deleteCitation);
}
else {
delete v.citation;
}
}
d3.csv("compounds_foods.csv", function(data) {
data.forEach(deleteCitation);
print(data);
});