Skip to content

Commit 74ef4f4

Browse files
committed
Updated docs for CSV options.
1 parent cbc8d34 commit 74ef4f4

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

package-lock.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-forge-fs",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "This library contains the file system extensions to Data-Forge that allow it to directly read and write CSV and JSON files in Node.js.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -35,7 +35,7 @@
3535
"chai": "^4.1.2"
3636
},
3737
"peerDependencies": {
38-
"data-forge": "^1.7.2"
38+
"data-forge": "^1.8.13"
3939
},
4040
"devDependencies": {
4141
"@types/chai": "^4.1.4",

src/index.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ declare module "data-forge/build/lib/dataframe" {
229229
* Treat the dataframe as CSV data for purposes of serialization.
230230
* This is the first step you need in serializing a dataframe to a CSV data file.
231231
*
232+
* @param options Options for CSV output. The options object is passed directly to PapaParse, please see [PapaParse docs for additional options](https://www.papaparse.com/docs#config).
233+
*
232234
* @return Returns a {@link ICsvSerializer} that represents the dataframe for serialization in the CSV format. Call `writeFile` or `writeFileSync` to output the CSV data to a text file.
233235
*
234236
* @example
@@ -242,8 +244,15 @@ declare module "data-forge/build/lib/dataframe" {
242244
*
243245
* await df.asCSV().writeFile("my-data-file.csv");
244246
* </pre>
247+
*
248+
* @example
249+
* <pre>
250+
*
251+
* const options = { ... };
252+
* await df.asCSV(options).writeFile("my-data-file.csv");
253+
* </pre>
245254
*/
246-
asCSV(): ICsvSerializer;
255+
asCSV(options?: ICSVOutputOptions): ICsvSerializer;
247256

248257
/**
249258
* Treat the dataframe as JSON data for purposes of serialization.
@@ -284,6 +293,8 @@ declare module "data-forge/build/lib/dataframe" {
284293
* Treat the dataframe as CSV data for purposes of serialization.
285294
* This is the first step you need in serializing a dataframe to a CSV data file.
286295
*
296+
* @param options Options for CSV output. The options object is passed directly to PapaParse, please see [PapaParse docs for additional options](https://www.papaparse.com/docs#config).
297+
*
287298
* @return Returns a {@link ICsvSerializer} that represents the dataframe for serialization in the CSV format. Call `writeFile` or `writeFileSync` to output the CSV data to a text file.
288299
*
289300
* @example
@@ -297,8 +308,15 @@ declare module "data-forge/build/lib/dataframe" {
297308
*
298309
* await df.asCSV().writeFile("my-data-file.csv");
299310
* </pre>
311+
*
312+
* @example
313+
* <pre>
314+
*
315+
* const options = { ... };
316+
* await df.asCSV(options).writeFile("my-data-file.csv");
317+
* </pre>
300318
*/
301-
asCSV(): ICsvSerializer;
319+
asCSV(options?: ICSVOutputOptions): ICsvSerializer;
302320

303321
/**
304322
* Treat the dataframe as JSON data for purposes of serialization.
@@ -326,7 +344,7 @@ declare module "data-forge/build/lib/dataframe" {
326344
* Treat the dataframe as CSV data for purposes of serialization.
327345
* This is the first step you need in serializing a dataframe to a CSV data file.
328346
*
329-
* @param [options] Optional configuration for CSV output.
347+
* @param options Options for CSV output. The options object is passed directly to PapaParse, please see [PapaParse docs for additional options](https://www.papaparse.com/docs#config).
330348
*
331349
* @return Returns a {@link ICsvSerializer} that represents the dataframe for serialization in the CSV format. Call `writeFile` or `writeFileSync` to output the CSV data to a text file.
332350
*
@@ -341,6 +359,13 @@ declare module "data-forge/build/lib/dataframe" {
341359
*
342360
* await df.asCSV().writeFile("my-data-file.csv");
343361
* </pre>
362+
*
363+
* @example
364+
* <pre>
365+
*
366+
* const options = { ... };
367+
* await df.asCSV(options).writeFile("my-data-file.csv");
368+
* </pre>
344369
*/
345370
export function asCSV<IndexT, ValueT>(this: IDataFrame<IndexT, ValueT>, options?: ICSVOutputOptions): ICsvSerializer {
346371
return new CsvSerializer<IndexT, ValueT>(this, options);

0 commit comments

Comments
 (0)