Array To CSV

    0

    0

    monizb

    Convert array elements to CSV

    const arrayToCSV = (arr, delimiter = ',') =>
      arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n');
    arrayToCSV([['a', 'b'], ['c', 'd']]); // '"a","b"\n"c","d"'
    arrayToCSV([['a', 'b'], ['c', 'd']], ';'); // '"a";"b"\n"c";"d"'
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.