How to code a pure JS.
To transform CSV string:
col1,col2\na,b\nc,d
Into this object structure:
{"a":["a","b"],"c":["c","d"]...}
So it can br refered by eg.: Obj.c, to return:
["c","d"]
Try to turn: "col1,col2\na,b\nc,d";
into an array of array: [['a','b'],['c','d']];
Calling this: CSVToArray("col1,col2\na,b\nc,d",",", true);
const CSVToArray = (data, delimiter = ",", omitFirstRow = false) =>
data.slice(omitFirstRow ? data.indexOf("\n") + 1 : 0).split("\n").map(v => v.split(delimiter));
What about turn "col1,col2\na,b\nc,d"; into readable referral object structure (by first item on each line)?
var Obj = {
"a":["a","b"],
"c":["c","d"],
...
}