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 1.1.1 to 1.1.2

5

libs/core/linesToJson.js
var parserMgr = require("./parserMgr.js");
var Parser = require("./parser");
var CSVError = require("./CSVError");
var numReg = /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/;
/**

@@ -110,3 +111,3 @@ * Convert lines of csv array into json

var title = getTitle(head, i, param)
if (flag === 'flat') {
if (flag === 'flat' || param.flatKeys) {
resultRow[title] = item

@@ -199,3 +200,3 @@ } else {

}
if (!isNaN(trimed)) {
if (numReg.test(trimed)) {
return numberType

@@ -202,0 +203,0 @@ } else if (trimed.length === 5 && trimed.toLowerCase() === "false" || trimed.length === 4 && trimed.toLowerCase() === "true") {

2

package.json

@@ -21,3 +21,3 @@ {

],
"version": "1.1.1",
"version": "1.1.2",
"keywords": [

@@ -24,0 +24,0 @@ "csv",

@@ -206,3 +206,3 @@ var Converter = require("../libs/core/Converter.js");

})
conv.on("end_parsed", function (res) {

@@ -345,3 +345,13 @@ assert(res[0].Description.indexOf('THIN') > -1);

})
it("should allow flatKey to change parse behaviour", function (done) {
var conv = new Converter({
flatKeys:true
});
conv.fromString("a.b,b.d,c.a\n1,2,3\n4,5,6").on("json", function (d) {
assert(d["a.b"])
assert(d["b.d"])
assert(d["c.a"])
})
.on("end", done)
})
});
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