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

connect-csv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-csv - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

49

index.js
(function(){
var connect, CSV, EnumHeaderConfig, DefaultHeaderConfig, split$ = ''.split, replace$ = ''.replace;
connect = require('connect');
CSV = require('csv-string');
CSV = require('csv');
EnumHeaderConfig = ['strict', 'guess', 'present', 'absent'];

@@ -46,27 +46,32 @@ DefaultHeaderConfig = 'strict';

x$.on('end', function(){
var res$, i$, to$, i, e;
var e;
try {
buf = replace$.call(buf, /\n*$/, '');
req.body = CSV.parse(buf);
if (header === 'guess') {
if (req.body.length && req.body[0].some((function(it){
return /^[-\d]/.exec(it);
}))) {
header = 'absent';
} else {
header = 'present';
return CSV().from(buf, {
delimiter: ','
}).to.array(function(body){
var res$, i$, to$, i;
req.body = body;
if (header === 'guess') {
if (req.body.length && req.body[0].some((function(it){
return /^[-\d]/.exec(it);
}))) {
header = 'absent';
} else {
header = 'present';
}
}
}
if (header === 'absent' && req.body.length) {
res$ = [];
for (i$ = 0, to$ = req.body[0].length; i$ < to$; ++i$) {
i = i$;
res$.push("_" + i);
if (header === 'absent' && req.body.length) {
res$ = [];
for (i$ = 0, to$ = req.body[0].length; i$ < to$; ++i$) {
i = i$;
res$.push("_" + i);
}
header = res$;
}
header = res$;
}
if (Array.isArray(header)) {
req.body.unshift(header);
}
return next();
if (Array.isArray(header)) {
req.body.unshift(header);
}
return next();
});
} catch (e$) {

@@ -73,0 +78,0 @@ e = e$;

@@ -9,9 +9,4 @@ {

"name": "connect-csv",
"keywords": [
"connect",
"middleware",
"csv"
],
"description": "Connect middleware for accepting text/csv data type",
"version": "0.0.1",
"version": "0.0.2",
"main": "lib/index.js",

@@ -30,3 +25,3 @@ "repository": {

"dependencies": {
"csv-string": "*",
"csv": "*",
"connect": "*"

@@ -33,0 +28,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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