Converts Javascript array data to CSV string data.
This is the module's main method. Almost all use of this module should be through this method.
The module is pre-loaded with sensible defaults; as a result, generally it's good enough to just call this with your data, like so:
import { to_csv } from 'csv_by_rfc';const data = [ ['ace', 'deuce', 'tres'], [1, 2, 3] ], csv = to_csv(data);console.log(csv); // 'ace,deuce,tres\r\n1,2,3' Copy
import { to_csv } from 'csv_by_rfc';const data = [ ['ace', 'deuce', 'tres'], [1, 2, 3] ], csv = to_csv(data);console.log(csv); // 'ace,deuce,tres\r\n1,2,3'
Of course, much of the purpose of a module like this is to make sure that the gross bits have been properly handled:
import { to_csv } from 'csv_by_rfc';const data = [ ['ace', 'deuce'], [1, 2], ['a"b', 'c\r\nd'] ];console.log( to_csv(data) ); // 'ace,deuce\r\n1,2\r\n"a""b","c\r\nd"' Copy
import { to_csv } from 'csv_by_rfc';const data = [ ['ace', 'deuce'], [1, 2], ['a"b', 'c\r\nd'] ];console.log( to_csv(data) ); // 'ace,deuce\r\n1,2\r\n"a""b","c\r\nd"'
whargarbl todo
The CSV's dataset
The dataset as a CSV string
Generated using TypeDoc
Main method
Converts Javascript array data to CSV string data.
This is the module's main method. Almost all use of this module should be through this method.
Basic usage
The module is pre-loaded with sensible defaults; as a result, generally it's good enough to just call this with your data, like so:
Embedded wacky text
Of course, much of the purpose of a module like this is to make sure that the gross bits have been properly handled:
Configuration
whargarbl todo