File tree 2 files changed +31
-2
lines changed
packages/csv-parse/samples
2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,21 @@ import assert from 'assert';
3
3
import { parse } from 'csv-parse' ;
4
4
5
5
parse ( `
6
- a,b|1,2|3,4
6
+ a,b
7
+ 1,2
8
+ 3,4
9
+ 5,6
7
10
` . trim ( ) , {
8
11
columns : true ,
9
- record_delimiter : '|' ,
10
12
from : 2
11
13
} , function ( err , records ) {
12
14
assert . deepStrictEqual (
13
15
records , [ {
14
16
a : '3' ,
15
17
b : '4'
18
+ } , {
19
+ a : '5' ,
20
+ b : '6'
16
21
} ]
17
22
) ;
18
23
} ) ;
Original file line number Diff line number Diff line change
1
+
2
+ import assert from 'assert' ;
3
+ import { parse } from 'csv-parse' ;
4
+
5
+ parse ( `
6
+ a,b
7
+ 1,2
8
+ 3,4
9
+ 5,6
10
+ ` . trim ( ) , {
11
+ columns : true ,
12
+ to : 2
13
+ } , function ( err , records ) {
14
+ console . log ( err , records )
15
+ assert . deepStrictEqual (
16
+ records , [ {
17
+ a : '1' ,
18
+ b : '2'
19
+ } , {
20
+ a : '3' ,
21
+ b : '4'
22
+ } ]
23
+ ) ;
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments