/node-minimal-csv-formatter

Transform arrays into CSV strings.

Primary LanguageJavaScriptMIT LicenseMIT

Minimal CSV Formatter

Build Status codecov npm version

Transforms arrays into equivalent CSV strings. Conforms to RFC 4180, with the exception that, instead of CRLF, LF is used as line delimiter.

Usage

const csv = require('minimal-csv-formatter');

let singleRow = csv(['x', 'y']);
// 'x,y\n'

let multipleRows = csv([
  [1, 2],
  [3, 4],
]);
// '1,2\n3,4\n'

let emptyFields = csv([null, undefined]);
// ',\n'

let emptyRows = csv([
  [],
  null,
  undefined,
]);
// ''