Improve arrayToCSV to escape quotes in strings and un-quote numeric values.
This commit is contained in:
@ -10,3 +10,6 @@ test('arrayToCSV works with default delimiter', () => {
|
||||
test('arrayToCSV works with custom delimiter', () => {
|
||||
expect(arrayToCSV([['a', 'b'], ['c', 'd']], ';')).toBe('"a";"b"\n"c";"d"');
|
||||
});
|
||||
test('arrayToCSV escapes quotes and doesn\'t quote numbers', () => {
|
||||
expect(arrayToCSV([['a', '"b" great'], ['c', 3.1415]])).toBe('"a","""b"" great"\n"c",3.1415');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user