From 8c1868ed2bc35d044a761a287d1593f404bdfd1a Mon Sep 17 00:00:00 2001 From: David Worms Date: Thu, 5 Oct 2023 16:18:03 +0200 Subject: [PATCH] docs(csv-stringify): eof samples --- packages/csv-stringify/samples/option.eof_false.js | 13 +++++++++++++ packages/csv-stringify/samples/option.eof_true.js | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 packages/csv-stringify/samples/option.eof_false.js create mode 100644 packages/csv-stringify/samples/option.eof_true.js diff --git a/packages/csv-stringify/samples/option.eof_false.js b/packages/csv-stringify/samples/option.eof_false.js new file mode 100644 index 00000000..01253bef --- /dev/null +++ b/packages/csv-stringify/samples/option.eof_false.js @@ -0,0 +1,13 @@ +import assert from "assert"; +import { stringify } from "csv-stringify/sync"; + +const data = stringify( + [ + ["a", "b"], + ["c", "d"], + ], + { + eof: false, + } +); +assert.deepStrictEqual(data, "a,b\nc,d"); diff --git a/packages/csv-stringify/samples/option.eof_true.js b/packages/csv-stringify/samples/option.eof_true.js new file mode 100644 index 00000000..ab4f1611 --- /dev/null +++ b/packages/csv-stringify/samples/option.eof_true.js @@ -0,0 +1,8 @@ +import assert from "assert"; +import { stringify } from "csv-stringify/sync"; + +const data = stringify([ + ["a", "b"], + ["c", "d"], +]); +assert.deepStrictEqual(data, "a,b\nc,d\n");