File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 23
23
. pipe ( csv . stringify ( {
24
24
quoted : true
25
25
} ) )
26
- // Print the CSV stream to stdout
26
+ // Print the CSV stream to stdout
27
27
. pipe ( process . stdout ) ;
Original file line number Diff line number Diff line change 1
-
2
- import assert from 'node:assert' ;
3
- import { generate , parse , transform , stringify } from 'csv/sync' ;
1
+ import assert from "node:assert" ;
2
+ import { generate , parse , transform , stringify } from "csv/sync" ;
4
3
5
4
// Run the pipeline
6
- const input = generate ( { seed : 1 , columns : 2 , length : 5 } ) ;
5
+ const input = generate ( { seed : 1 , columns : 2 , length : 2 } ) ;
7
6
const rawRecords = parse ( input ) ;
8
- const refinedRecords = transform ( rawRecords , function ( data ) {
9
- return data . map ( function ( value ) { return value . toUpperCase ( ) ; } ) ;
10
- } ) ;
7
+ const refinedRecords = transform ( rawRecords , ( data ) =>
8
+ data . map ( ( value ) => value . toUpperCase ( ) )
9
+ ) ;
11
10
const output = stringify ( refinedRecords ) ;
12
11
// Print the final result
13
- assert . equal ( output ,
14
- `OMH,ONKCHHJMJADOA
15
- D,GEACHIN
16
- NNMIN,CGFDKB
17
- NIL,JNNMJADNMINL
18
- KB,DMIM
19
- ` ) ;
12
+ assert . equal ( output , `OMH,ONKCHHJMJADOA\nD,GEACHIN\n` ) ;
You can’t perform that action at this time.
0 commit comments