Comparing version 0.5.8 to 0.5.9
@@ -55,3 +55,3 @@ | ||
if (e[len-1] === quote){ // possible close | ||
if (e[len-2]!==quote){ // close quote | ||
if (e[len-2]!==quote || e[len-2]===quote && e[len-3] === quote){ // close quote | ||
e=e.substring(0,len-1); | ||
@@ -78,7 +78,7 @@ e=twoDoubleQuote(e,quote); | ||
}else{ //previous quote not closed | ||
if (e[len-1] === quote && e[len-2] !==quote){ //close double quote | ||
if (e[len-1] === quote && (e[len-2] !==quote || e[len-2] === quote && e[len-3] === quote)){ //close double quote | ||
inquote=false; | ||
e=e.substr(0,len-1); | ||
quoteBuff+=delimiter+e; | ||
quoteBuf=twoDoubleQuote(quoteBuff,quote); | ||
quoteBuff=twoDoubleQuote(quoteBuff,quote); | ||
if (trim){ | ||
@@ -85,0 +85,0 @@ quoteBuff=quoteBuff.trimRight(); |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.5.8", | ||
"version": "0.5.9", | ||
"keywords": [ | ||
@@ -24,0 +24,0 @@ "csv", |
@@ -155,3 +155,17 @@ var Converter = require("../libs/core/Converter.js"); | ||
}) | ||
}); | ||
it ("should convert triple quotes correctly",function(done){ | ||
var testData = __dirname + "/data/dataWithTripleQoutes"; | ||
var rs = fs.createReadStream(testData); | ||
var conv=new Converter({trim:true}); | ||
conv.on("end_parsed",function(res){ | ||
console.log(res); | ||
assert.equal(res[0].Description,"ac, abs, moon"); | ||
assert.equal(res[1].Model,"Venture \"Extended Edition\""); | ||
assert.equal(res[2].Model,"Venture \"Extended Edition, Very Large\""); | ||
done(); | ||
}); | ||
rs.pipe(conv); | ||
}); | ||
// it ("should convert big csv",function(done){ | ||
@@ -158,0 +172,0 @@ // // var rs=fs.createReadStream(__dirname+"/data/large-csv-sample.csv"); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
786567
76
12031