Skip to content

Commit

Permalink
docs: simplify dirname declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Jan 8, 2024
1 parent a312a7c commit ddd750f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions packages/csv-parse/samples/columns-discovery.js
Expand Up @@ -2,9 +2,7 @@
import fs from 'fs';
import { parse } from 'csv-parse';

import { dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const __dirname = new URL( '.', import.meta.url).pathname

// Using the first line of the CSV data to discover the column names
const rs = fs.createReadStream(__dirname+'/columns-discovery.in');
Expand Down
4 changes: 1 addition & 3 deletions packages/csv-parse/samples/fs_read.js
Expand Up @@ -2,9 +2,7 @@
import fs from 'fs';
import { parse } from 'csv-parse';

import { dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const __dirname = new URL( '.', import.meta.url).pathname

const parser = parse({delimiter: ';'}, function(err, data){
console.log(data);
Expand Down
4 changes: 1 addition & 3 deletions packages/csv-parse/samples/recipe.async.iterator.coffee
Expand Up @@ -2,9 +2,7 @@
import fs from 'fs'
import { parse } from 'csv-parse'

import { dirname } from 'path'
import { fileURLToPath } from 'url';
__dirname = dirname fileURLToPath `import.meta.url`
const __dirname = new URL( '.', import.meta.url).pathname

processFile = () ->
records = []
Expand Down
4 changes: 1 addition & 3 deletions packages/csv-parse/samples/recipe.async.iterator.js
Expand Up @@ -2,9 +2,7 @@
import fs from 'fs';
import { parse } from 'csv-parse';

import { dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const __dirname = new URL( '.', import.meta.url).pathname

const processFile = async () => {
const records = [];
Expand Down

0 comments on commit ddd750f

Please sign in to comment.