Skip to content

Commit

Permalink
Extract deps from converter and Delete await keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-ma committed Feb 1, 2023
1 parent afcd053 commit f9599d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export { Confirm, Input, Number } from "https://deno.land/x/cliffy@v0.25.4/promp

export { Sha1 } from "https://deno.land/std@0.146.0/hash/sha1.ts";

export { parse } from "https://deno.land/std@0.174.0/encoding/csv.ts";

export const zipWrapper = {
decompress: _decompress,
};
Expand Down
4 changes: 2 additions & 2 deletions libs/postprocess/csv_to_json_converter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { parse } from "https://deno.land/std@0.174.0/encoding/csv.ts";
import { parse } from "../../deps.ts";
import { Colors } from "../../deps.ts";
import { BasePostprocess } from "./base_postprocess.ts";

export class CsvToJsonConverter extends BasePostprocess {
async execute(_: string[], targetPath: string): Promise<string> {
const text = await Deno.readTextFile(targetPath);
const result = await parse(text, { skipFirstRow: true });
const result = parse(text, { skipFirstRow: true });
Deno.writeTextFileSync(targetPath.replace(/\.csv?$/, ".json"), JSON.stringify(result));
return targetPath;
}
Expand Down

0 comments on commit f9599d2

Please sign in to comment.