MCPcopy Create free account
hub / github.com/codemistic/Web-Development / CSVToJSON

Function CSVToJSON

jsonRenderer2/src/App.js:94–104  ·  view source on GitHub ↗
(csv)

Source from the content-addressed store, hash-verified

92
93//function used to convert csv content to json
94const CSVToJSON = (csv) => {
95 const lines = csv.split('\n');
96 const keys = lines[0].split(',');
97 return lines.slice(1).map(line => {
98 return line.split(',').reduce((acc, cur, i) => {
99 const toAdd = {};
100 toAdd[keys[i]] = cur;
101 return { ...acc, ...toAdd };
102 }, {});
103 });
104};
105
106//function used to render table heading
107const ThData =(column)=>{

Callers 1

App.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected