Wrapping each element of the the row in quotes

Commas inside of an element were not supported as the element in the data source wasn't being wrapped in quotes. Wrapping the element in quotes before joining should resolve the problem.
This commit is contained in:
quintezkiller 2017-03-09 07:42:35 -05:00 committed by GitHub
commit 56ab83adcd

View file

@ -19,7 +19,7 @@ export const jsons2arrays = (jsons, headers) => {
};
export const joiner = ((data,separator = ',') =>
data.map((row, index) => row.join(separator)).join(`\n`)
data.map((row, index) => row.map((element) => "\"" + element + "\"").join(separator)).join(`\n`)
);
export const arrays2csv = ((data, headers, separator) =>