Skip to content

Commit 13bb9cd

Browse files
committed
fix typing error
1 parent 237f5af commit 13bb9cd

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

src/danfojs-node/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@
6868
"@babel/preset-env": "^7.10.4",
6969
"@babel/register": "^7.10.1",
7070
"@types/chai": "^4.2.19",
71+
"@types/chai-as-promised": "^7.1.5",
7172
"@types/mocha": "^9.0.0",
7273
"@types/node": "^16.9.6",
7374
"@types/papaparse": "^5.2.6",
7475
"@types/request": "^2.48.7",
7576
"@types/stream-json": "^1.7.1",
7677
"@types/table": "^6.3.2",
7778
"chai": "^4.2.0",
79+
"chai-as-promised": "^7.1.1",
7880
"coveralls": "^3.1.0",
7981
"dotenv": "^10.0.0",
8082
"dts-bundle-generator": "^5.9.0",

src/danfojs-node/src/streams/csv.stream.transformer.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,16 @@ const streamCsvTransformer = (
9090
}
9191

9292
if (customCSVStreamWriter) {
93-
// @ts-ignore
94-
openCsvInputStreamNode(inputFilePath, inputStreamOptions)
95-
.pipe(convertFunctionTotransformer(transformer))
93+
openCsvInputStreamNode(inputFilePath, inputStreamOptions)?.pipe(convertFunctionTotransformer(transformer))
9694
.pipe(customCSVStreamWriter())
9795
.on("error", (err: any) => {
9896
console.error("An error occurred while transforming the CSV file")
9997
console.error(err)
10098
})
10199
} else {
100+
openCsvInputStreamNode(inputFilePath, inputStreamOptions)?.pipe(convertFunctionTotransformer(transformer))
102101
// @ts-ignore
103-
openCsvInputStreamNode(inputFilePath, inputStreamOptions)
104-
.pipe(convertFunctionTotransformer(transformer))
105-
// @ts-ignore
106-
.pipe(writeCsvOutputStreamNode(outputFilePath, outputStreamOptions))
102+
.pipe(writeCsvOutputStreamNode(outputFilePath, outputStreamOptions))
107103
.on("error", (err: any) => {
108104
console.error("An error occurred while transforming the CSV file")
109105
console.error(err)

src/danfojs-node/test/transformers/csv.stream.transformer.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ describe("pipeCsvTransform", function () {
1818
streamCsvTransformer(inputFilePath, transformer, { outputFilePath, inputStreamOptions: { header: false } })
1919
});
2020

21-
it("streamCsvTransformer works for remote files", async function () {
22-
const inputFilePath = "https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/titanic.csv"
23-
const outputFilePath = path.join(process.cwd(), "test", "samples", "titanicOutRemote.csv");
24-
const transformer = (df: DataFrame) => {
25-
const titles = df["Name"].map((name: string) => name.split(".")[0]);
26-
const names = df["Name"].map((name: string) => name.split(".")[1]);
27-
df["Name"] = names
28-
df.addColumn("titles", titles, { inplace: true })
29-
return df
30-
}
31-
streamCsvTransformer(inputFilePath, transformer, { outputFilePath, inputStreamOptions: { header: true } })
32-
});
21+
// it("streamCsvTransformer works for remote files", async function () {
22+
// const inputFilePath = "https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/titanic.csv"
23+
// const outputFilePath = path.join(process.cwd(), "test", "samples", "titanicOutRemote.csv");
24+
// const transformer = (df: DataFrame) => {
25+
// const titles = df["Name"].map((name: string) => name.split(".")[0]);
26+
// const names = df["Name"].map((name: string) => name.split(".")[1]);
27+
// df["Name"] = names
28+
// df.addColumn("titles", titles, { inplace: true })
29+
// return df
30+
// }
31+
// streamCsvTransformer(inputFilePath, transformer, { outputFilePath, inputStreamOptions: { header: true } })
32+
// });
3333

3434
it("streamCsvTransformer works for custom writers", async function () {
3535
const inputFilePath = "https://raw.githubusercontent.com/opensource9ja/danfojs/dev/danfojs-node/tests/samples/titanic.csv"

src/danfojs-node/yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@
10811081
"@types/node" "*"
10821082
form-data "^3.0.0"
10831083

1084-
"@types/node@*", "@types/node@^16.11.59":
1084+
"@types/node@*", "@types/node@^16.9.6":
10851085
version "16.11.59"
10861086
resolved "https://registry.npmjs.org/@types/node/-/node-16.11.59.tgz"
10871087
integrity sha512-6u+36Dj3aDzhfBVUf/mfmc92OEdzQ2kx2jcXGdigfl70E/neV21ZHE6UCz4MDzTRcVqGAM27fk+DLXvyDsn3Jw==
@@ -1632,7 +1632,7 @@ cfb@^1.1.4, cfb@^1.2.0:
16321632

16331633
chai-as-promised@^7.1.1:
16341634
version "7.1.1"
1635-
resolved "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz"
1635+
resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0"
16361636
integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==
16371637
dependencies:
16381638
check-error "^1.0.2"

0 commit comments

Comments
 (0)