fix: more bugs

This commit is contained in:
orion 2024-05-01 10:01:22 -05:00
parent 60346c9c10
commit 0a9beb46ea
Signed by: orion
GPG Key ID: 6D4165AE4C928719
3 changed files with 8 additions and 11 deletions

View File

@ -6,11 +6,12 @@ workspace:
- aff: ">=7.1.0 <8.0.0" - aff: ">=7.1.0 <8.0.0"
- arrays: ">=7.3.0 <8.0.0" - arrays: ">=7.3.0 <8.0.0"
- bifunctors: ">=6.0.0 <7.0.0" - bifunctors: ">=6.0.0 <7.0.0"
- control
- datetime: ">=6.1.0 <7.0.0" - datetime: ">=6.1.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0" - effect: ">=4.0.0 <5.0.0"
- either: ">=6.1.0 <7.0.0" - either: ">=6.1.0 <7.0.0"
- exceptions: ">=6.0.0 <7.0.0" - exceptions: ">=6.0.0 <7.0.0"
- filterable - filterable: ">=5.0.0 <6.0.0"
- foldable-traversable: ">=6.0.0 <7.0.0" - foldable-traversable: ">=6.0.0 <7.0.0"
- foreign: ">=7.0.0 <8.0.0" - foreign: ">=7.0.0 <8.0.0"
- foreign-object: ">=4.1.0 <5.0.0" - foreign-object: ">=4.1.0 <5.0.0"
@ -23,6 +24,7 @@ workspace:
- node-streams: ">=9.0.0 <10.0.0" - node-streams: ">=9.0.0 <10.0.0"
- nullable: ">=6.0.0 <7.0.0" - nullable: ">=6.0.0 <7.0.0"
- numbers: ">=9.0.1 <10.0.0" - numbers: ">=9.0.1 <10.0.0"
- ordered-collections
- precise-datetime: ">=7.0.0 <8.0.0" - precise-datetime: ">=7.0.0 <8.0.0"
- prelude: ">=6.0.1 <7.0.0" - prelude: ">=6.0.1 <7.0.0"
- record: ">=4.0.0 <5.0.0" - record: ">=4.0.0 <5.0.0"

View File

@ -13,6 +13,7 @@ package:
- aff: ">=7.1.0 <8.0.0" - aff: ">=7.1.0 <8.0.0"
- arrays: ">=7.3.0 <8.0.0" - arrays: ">=7.3.0 <8.0.0"
- bifunctors: ">=6.0.0 <7.0.0" - bifunctors: ">=6.0.0 <7.0.0"
- control: ">=6.0.0 <7.0.0"
- datetime: ">=6.1.0 <7.0.0" - datetime: ">=6.1.0 <7.0.0"
- effect: ">=4.0.0 <5.0.0" - effect: ">=4.0.0 <5.0.0"
- either: ">=6.1.0 <7.0.0" - either: ">=6.1.0 <7.0.0"
@ -30,6 +31,7 @@ package:
- node-streams: ">=9.0.0 <10.0.0" - node-streams: ">=9.0.0 <10.0.0"
- nullable: ">=6.0.0 <7.0.0" - nullable: ">=6.0.0 <7.0.0"
- numbers: ">=9.0.1 <10.0.0" - numbers: ">=9.0.1 <10.0.0"
- ordered-collections: ">=3.2.0 <4.0.0"
- precise-datetime: ">=7.0.0 <8.0.0" - precise-datetime: ">=7.0.0 <8.0.0"
- prelude: ">=6.0.1 <7.0.0" - prelude: ">=6.0.1 <7.0.0"
- record: ">=4.0.0 <5.0.0" - record: ">=4.0.0 <5.0.0"

View File

@ -10,21 +10,14 @@ class ParserWithColumns extends Parser {
/** @type {(s: import('csv-parse').Options) => () => ParserWithColumns} */ /** @type {(s: import('csv-parse').Options) => () => ParserWithColumns} */
export const makeImpl = c => () => { export const makeImpl = c => () => {
const parser = new ParserWithColumns(c) const parser = new ParserWithColumns(c)
parser.once('data', columns => { parser.once('readable', () => {
parser.columns = columns; parser.columns = parser.read();
}) })
return parser return parser
} }
/** @type {(s: ParserWithColumns) => () => Array<string> | null} */ /** @type {(s: ParserWithColumns) => () => Array<string> | null} */
export const readImpl = p => () => { export const readImpl = p => () => p.read();
const chunk = p.read();
if (chunk === p.columns) {
return p.read()
} else {
return chunk
}
}
/** @type {(s: ParserWithColumns) => () => Array<string>} */ /** @type {(s: ParserWithColumns) => () => Array<string>} */
export const columnsArrayImpl = p => () => p.columns export const columnsArrayImpl = p => () => p.columns