From b297dd438227aad2c8118a8e95737ae3f6e0af06 Mon Sep 17 00:00:00 2001 From: David Marr Date: Fri, 5 Jan 2024 15:32:27 -0500 Subject: [PATCH] Support --auto-type flag from csv2json cli --- 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"