connect-csv
Advanced tools
Comparing version 0.0.2 to 0.1.0
19
index.js
(function(){ | ||
var connect, CSV, EnumHeaderConfig, DefaultHeaderConfig, split$ = ''.split, replace$ = ''.replace; | ||
var connect, csvParse, typeIs, EnumHeaderConfig, DefaultHeaderConfig, split$ = ''.split, replace$ = ''.replace; | ||
connect = require('connect'); | ||
CSV = require('csv'); | ||
csvParse = require('csv-parse'); | ||
typeIs = require('type-is'); | ||
EnumHeaderConfig = ['strict', 'guess', 'present', 'absent']; | ||
@@ -21,7 +22,7 @@ DefaultHeaderConfig = 'strict'; | ||
} | ||
if (connect.utils.mime(req) !== 'text/csv') { | ||
if (!typeIs(req, 'text/csv')) { | ||
return next(); | ||
} | ||
header = headerConfig; | ||
if (header == 'strict' || header == 'guess') { | ||
if (header === 'strict' || header === 'guess') { | ||
for (i$ = 0, len$ = (ref$ = split$.call(req.headers['content-type'], ';')).length; i$ < len$; ++i$) { | ||
@@ -50,5 +51,5 @@ chunk = ref$[i$]; | ||
buf = replace$.call(buf, /\n*$/, ''); | ||
return CSV().from(buf, { | ||
return csvParse(buf, { | ||
delimiter: ',' | ||
}).to.array(function(body){ | ||
}, function(_, body){ | ||
var res$, i$, to$, i; | ||
@@ -89,7 +90,7 @@ req.body = body; | ||
}; | ||
function in$(x, arr){ | ||
var i = -1, l = arr.length >>> 0; | ||
while (++i < l) if (x === arr[i] && i in arr) return true; | ||
function in$(x, xs){ | ||
var i = -1, l = xs.length >>> 0; | ||
while (++i < l) if (x === xs[i]) return true; | ||
return false; | ||
} | ||
}).call(this); |
@@ -9,4 +9,9 @@ { | ||
"name": "connect-csv", | ||
"keywords": [ | ||
"connect", | ||
"middleware", | ||
"csv" | ||
], | ||
"description": "Connect middleware for accepting text/csv data type", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"main": "lib/index.js", | ||
@@ -25,9 +30,10 @@ "repository": { | ||
"dependencies": { | ||
"csv": "*", | ||
"connect": "*" | ||
"connect": "3.x.x", | ||
"csv-parse": "0.0.6", | ||
"type-is": "1.3.x" | ||
}, | ||
"devDependencies": { | ||
"LiveScript": "1.1.x" | ||
"LiveScript": "1.2.x" | ||
}, | ||
"optionalDependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
7680
93
1
3
+ Addedcsv-parse@0.0.6
+ Addedtype-is@1.3.x
+ Addedcsv-parse@0.0.6(transitive)
+ Addedmedia-typer@0.2.0(transitive)
+ Addedmime-types@1.0.2(transitive)
+ Addedtype-is@1.3.2(transitive)
- Removedcsv@*
- Removedcsv@6.3.11(transitive)
- Removedcsv-generate@4.4.2(transitive)
- Removedcsv-parse@5.6.0(transitive)
- Removedcsv-stringify@6.5.2(transitive)
- Removedstream-transform@3.3.3(transitive)
Updatedconnect@3.x.x