From 398235d71302edffc9467a462f039c5c7bffeef0 Mon Sep 17 00:00:00 2001 From: anuveyatsu Date: Thu, 8 Feb 2018 00:36:29 +0600 Subject: [PATCH] [escapeChar][xs]: using double quotes as escape character - refs https://github.com/datahq/data-cli/issues/253 --- lib/index.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index b0af692..7a9b5f8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -93,7 +93,11 @@ class File { // Get parserOptions so we can use it when "infering" schema: const parserOptions = await guessParseOptions(this) // We also need to include parserOptions in "dialect" property of descriptor: - this.descriptor.dialect = parserOptions + this.descriptor.dialect = { + delimiter: parserOptions.delimiter, + quoteChar: parserOptions.quote, + escapeChar: '"' // Setting it as double quote so we have standard escape character (it's same for our csv parser) + } // Now let's get a stream from file and infer schema: const stream = await this.stream() this.descriptor.schema = await infer(stream, parserOptions) diff --git a/package.json b/package.json index 2eaf27b..38ace46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "data.js", - "version": "0.10.4", + "version": "0.10.5", "description": "", "main": "lib/index.js", "directories": {