Skip to content

Commit 83537a2

Browse files
committed
docs(csv): sample simplification
1 parent 49f9ccc commit 83537a2

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

packages/csv/samples/pipe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ csv
2323
.pipe(csv.stringify({
2424
quoted: true
2525
}))
26-
// Print the CSV stream to stdout
26+
// Print the CSV stream to stdout
2727
.pipe(process.stdout);

packages/csv/samples/sync.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
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";
43

54
// Run the pipeline
6-
const input = generate({seed: 1, columns: 2, length: 5});
5+
const input = generate({ seed: 1, columns: 2, length: 2 });
76
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+
);
1110
const output = stringify(refinedRecords);
1211
// 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`);

0 commit comments

Comments
 (0)