csv
is designed to be a CSV analogue to the standard JSON module.
npm i @voidvoxel/csv
import * as CSV from "@voidvoxel/csv";
const CSV = require("@voidvoxel/csv");
const csv = `name,gender,age
Ashlynn,female,25
Haley,female,25
Carlos,male,28
Kua,male,23`;
const array = CSV.parse(csv);
console.log(array);
const array = [
{ name: 'Ashlynn', gender: 'female', age: '25' },
{ name: 'Haley', gender: 'female', age: '25' },
{ name: 'Carlos', gender: 'male', age: '28' },
{ name: 'Kua', gender: 'male', age: '23' }
];
const csv = CSV.stringify(array);
console.log(csv);