Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

csvtojson

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csvtojson - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9

test/data/dataWithTripleQoutes

6

libs/core/utils.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc