From f44bb2e666d57113bbd07c655dc67e051129f702 Mon Sep 17 00:00:00 2001 From: Andrew Milligan Date: Tue, 16 Aug 2022 19:12:01 -0700 Subject: [PATCH] Import autoType function in bin/dsv2json.js * Import `autoType` function in `bin/dsv2json.js` The script was still looking for `dsv.autoType`, expecting a wildcard import of the whole package, which caused the `-a` flag to throw an exception since the refactor for type=module in a3bb50a7ad10a25d9b54a900a635fcda80943d43 --- bin/dsv2json.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/dsv2json.js b/bin/dsv2json.js index c2a447f..6df24be 100755 --- a/bin/dsv2json.js +++ b/bin/dsv2json.js @@ -7,7 +7,7 @@ import {fileURLToPath} from "url"; import rw from "rw"; import {program} from "commander"; import iconv from "iconv-lite"; -import {dsvFormat} from "../src/index.js"; +import {autoType, dsvFormat} from "../src/index.js"; const progname = basename(process.argv[1]); const defaultInDelimiter = progname.slice(0, 3) === "tsv" ? "\t" : ","; @@ -28,7 +28,7 @@ const inFormat = dsvFormat(options.inputDelimiter); rw.dash.readFile(program.args[0] || "-", (error, text) => { if (error) throw error; - const rowConverter = options.autoType ? dsv.autoType : null + const rowConverter = options.autoType ? autoType : null const rows = inFormat.parse(iconv.decode(text, options.inputEncoding), rowConverter); rw.dash.writeFile(options.out, iconv.encode(options.newlineDelimited ? rows.map((row) => JSON.stringify(row)).join("\n") + "\n"