UNPKG

simplecsv

Version:

Fast and compact CSV parser for parsing CSV with CSV to JSON support.

81 lines (80 loc) 2.27 kB
{ "testcases" : [ { "testname": "1.should parse \\n at the end correctly", "instances": [ "yoga,\ntramendous,\n", "yoga,\ntramendous,\"\n", "yoga,\ntramendous,\"yoga\n", "yoga,\ntramendous,\"\n\"", "yoga,\ntramendous,\"\n\"\n", "\"yoga\",\"\r\",yoga9", "\"y\roga\",\"\r\",yoga9", "yoga,\"\n\",yoga8", "yoga,\"\r\n\",yoga7", "yoga,\n,yoga2", "yo ga,\n, yoga2", "\"yo ga\",\n, yoga2" ] }, { "testname": "2.should parse \\n and , as terminators", "instances": [ "\n\n\n\n\n\n\n", ",,\n,,", "", "\n", "," ] }, { "testname": "3.should parse # as comment line", "hasComments": true, "instances": [ "# This is a comment, you should not see this\n#\"This is also a comment", "This, is, not, a, comment,\n # This is not a comment, even though it has #,\n" ] }, { "testname": "4.should parse \" correctly", "instances": [ "yoga\\'s,\"yoga\"\"s\",\"\"\",\"\"\",314,\"\"\"\"" ] }, { "testname": "5.should parse \" correctly", "delim": ",", "instances": [ "FirstName,LastName,Title,ReportsTo.Email,Birthdate,Description", "Tom,Jones,Senior Director,buyer@salesforcesample.com,1940-06-07Z,\"Self-described as \"\"the top\"\" branding guru on the West Coast\"", "Ian,Dury,Chief Imagineer,cto@salesforcesample.com,,\"World-renowned expert in fuzzy logic design.\nInfluential in technology purchases.\"" ] }, { "testname": "6.can work with delim param", "delim": ".", "instances": [ "\n\n\n\n\n\n\n", "..\n.." ] }, { "testname": "7.should parse \\r\\nn, \\r and \\n correctly", "instances": [ "yo,\ntre,\n", "yo,\r\ntre,\n", "dous,\"\r", "dous,\"yoga\r\n", "dous,\"\n\r\"", "dous,\"\n\r\r\"\n", "\"yoga\",\"\r\r\n\",yoga9", "\"y\roga\",\"\r\",yoga9", "yoga,\"\n\",\nyoga8", "yoga,\"\r\n\",yoga7", "yoga,\n,yoga2", "yo ga,\n, yoga2", "\"yo ga\",\n, yoga2" ] } ] }