From: Ardis Lu Date: Sun, 16 Feb 2025 07:37:23 +0000 (-0800) Subject: Use package name for imports X-Git-Tag: v0.1.0~49 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=14f2ebccdb079677cfe3bf95571c140b81fa21a5;p=csvio Use package name for imports --- diff --git a/README.md b/README.md index 3768a4c..2ced172 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ CA-4321 | 4 | 3.43 Run: ```javascript -import { CSVReader, CSVTransformer, CSVWriter } from './src/index.js'; +import { CSVReader, CSVTransformer, CSVWriter } from 'csvio'; function calculate(row) { // Input is a simple array representing one CSV row const [country, id] = row[0].split('-'); @@ -76,7 +76,7 @@ The core API is contained in `src/core.js` and exposes three classes to read, tr A `ReadableStream` where each chunk is one row from a local CSV file. ```javascript -import { CSVReader } from './src/index.js'; +import { CSVReader } from 'csvio'; const readableStream = new CSVReader('./examples/data/ex1_1-in.csv'); @@ -96,7 +96,7 @@ for await (const row of readableStream) { A `TransformStream` that will apply a given function to each row in a streamed CSV. ```javascript -import { CSVTransformer } from './src/index.js'; +import { CSVTransformer } from 'csvio'; function edit(row) { return [`${row[0]}: transformed!`]; @@ -125,7 +125,7 @@ for await (const row of rows) { A `WritableStream` to save CSV row data to disk. ```javascript -import { CSVWriter } from './src/index.js'; +import { CSVWriter } from 'csvio'; const writableStream = new CSVWriter('./example.csv');