Skip to content

Commit

Permalink
upgrades csv parser module
Browse files Browse the repository at this point in the history
  • Loading branch information
pstaender committed Apr 21, 2024
1 parent 7371ac2 commit 75ed119
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -7,7 +7,7 @@
"csv2md": "bin/csv2md"
},
"scripts": {
"test": "npx mocha test/**/test.ts",
"test": "npm run build; npx mocha test/**/*.ts",
"build": "tsc --project tsconfig.json",
"watch": "tsc --project tsconfig.json -w"
},
Expand All @@ -26,7 +26,7 @@
"author": "Philipp Staender <pstaender@mailbox.org>",
"license": "MIT",
"dependencies": {
"csv-parse": "^4.11.1",
"csv-parse": "^5",
"get-stream": "^9.0.1",
"stream-transform": "^2.1.3",
"yargs": "^17"
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Expand Up @@ -7,7 +7,7 @@ const defaultCsv2md = new Csv2md()
const { argv } = yargs
.usage(
`Converts CSV data to Markdown tables
(c) 2014-2020 by Philipp Staender, MIT License
(c) 2014-2024 by Philipp Staender, MIT License
Usage: $0 [options] <csvfile>`
)
Expand Down Expand Up @@ -77,7 +77,7 @@ const options: Options = {

const csv2md = new Csv2md(options)

import * as parse from 'csv-parse'
import { parse } from 'csv-parse'
import * as transform from 'stream-transform'

const parser = parse({
Expand Down
4 changes: 2 additions & 2 deletions src/csv2md.ts
@@ -1,4 +1,4 @@
import parseSync from 'csv-parse/lib/sync'
import { parse } from 'csv-parse/sync'

export interface Options {
pretty?: boolean
Expand Down Expand Up @@ -197,7 +197,7 @@ export class Csv2md implements Options {
}

csv2md(csv: string): string {
const data = parseSync(csv, {
const data = parse(csv, {
comment: this.csvComment,
delimiter: this.csvDelimiter,
quote: this.csvQuote,
Expand Down
2 changes: 1 addition & 1 deletion test/test.ts
@@ -1,7 +1,7 @@
import 'source-map-support/register'

import { expect } from 'chai'
import parse from 'csv-parse'
import { parse } from 'csv-parse'
import { Csv2md, csv2md } from '../src/csv2md'

const csvOptions = {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -3,7 +3,7 @@
"module": "commonjs",
"strict": true,
"outDir": "dist",
"allowSyntheticDefaultImports": true,
// "allowSyntheticDefaultImports": true,
"sourceMap": true,
"skipLibCheck": true
},
Expand Down

0 comments on commit 75ed119

Please sign in to comment.