Skip to content

Commit ef5174c

Browse files
committed
docs: cjs demo with node > 12 ts import
1 parent 35c1f4a commit ef5174c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

demo/cjs/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
# Node.js CSV demo for CommonJS
33

44
The package exposes a few JavaScript and TypeScript examples to import the CSV parser using the CommonJS module loader.
5+
6+
## Testing
7+
8+
For Node.js 12 and above, run `yarn test`. For versions below 12 and above 8, run `./test/node8.sh`.

demo/cjs/lib/csv_sync.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
// Import the package sync module
33
// Node.js >= 14
4-
// import * as csv from 'csv/sync';
4+
import * as csv from 'csv/sync';
55
// Node.js < 14
6-
import * as csv from 'csv/dist/cjs/sync';
6+
// import * as csv from 'csv/dist/cjs/sync';
77

88
// Generate 20 records
99
const input: string = csv.generate({

demo/cjs/lib/parse_sync.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
import assert from 'assert'
33
// Node.js >= 14
4-
// import { parse } from 'csv-parse/sync'
4+
import { parse } from 'csv-parse/sync'
55
// Node.js < 14
6-
import { parse } from 'csv-parse/dist/cjs/sync'
6+
// import { parse } from 'csv-parse/dist/cjs/sync'
77

88
// Create the parser
99
const records: [] = parse([

0 commit comments

Comments
 (0)