mholt/PapaParse

Quote only strings and not numbers

オープン

#532 opened on 2018/07/05

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (1,185 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (13,548 個のスター)
PR merge metrics
 (平均マージ 18h) (30d で 1 merged PR)

説明

I'm parsing the following file (quoted strings, non-quotes numbers):

name,age,city
"Chirstian",30,"Hamburg"

The option dynamicTyping detects name and city as strings and the age as number. If I unparse, I have two options.

Option 1) set quoteChar: '"', which results in:
name,age,city
"Chirstian","30","Hamburg"
Option 1) Skip the option `quoteChar, which results in:
name,age,city
Chirstian,30,Hamburg

I recommend an option onlyQuoteStrings, which applies the quoteChar: '"' only to strings, but not to numbers, similar to libre office save as CSV dialogue (option quote all text cells):

bildschirmfoto vom 2018-07-05 23 59 54

コントリビューターガイド