csv-parser
Advanced tools
Comparing version 1.4.3 to 1.4.4
@@ -7,3 +7,3 @@ var fs = require('fs'); | ||
fs.createReadStream('/tmp/tmp.csv') | ||
fs.createReadStream(process.argv[2] || '/tmp/tmp.csv') | ||
.pipe(csv()) | ||
@@ -10,0 +10,0 @@ .on('data', function(line) { |
16
index.js
var stream = require('stream') | ||
var inherits = require('inherits') | ||
var gen = require('generate-object-property') | ||
var genobj = require('generate-object-property') | ||
var genfun = require('generate-function') | ||
@@ -116,8 +117,13 @@ var quote = new Buffer('"')[0] | ||
var props = this.headers.map(function(cell, i) { | ||
return '\t'+gen('this', cell)+' = cells['+i+']' | ||
}).join('\n')+'\n' | ||
var Row = genfun() | ||
('function Row(cells) {') | ||
this._Row = new Function('return function Row(cells) {\n'+props+'}')() | ||
this.headers.forEach(function(cell, i) { | ||
Row('%s = cells[%d]', genobj('this', cell), i) | ||
}) | ||
Row('}') | ||
this._Row = Row.toFunction() | ||
if (Object.defineProperty) { | ||
@@ -124,0 +130,0 @@ Object.defineProperty(this._Row.prototype, 'headers', { |
{ | ||
"name": "csv-parser", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"description": "Streaming csv parser inspired by binary-csv that aims to be faster than everyone else", | ||
"repository": "mafintosh/csv-parser", | ||
"dependencies": { | ||
"generate-function": "^1.0.1", | ||
"generate-object-property": "^1.0.0", | ||
"inherits": "^2.0.1", | ||
"ldjson-stream": "^1.1.0", | ||
"minimist": "^0.2.0", | ||
"inherits": "^2.0.1" | ||
"minimist": "^0.2.0" | ||
}, | ||
@@ -12,0 +13,0 @@ "devDependencies": { |
# csv-parser | ||
Streaming csv parser inspired by binary-csv that aims to be faster than everyone else | ||
Streaming csv parser inspired by binary-csv that aims to be faster than everyone else. | ||
@@ -12,2 +12,4 @@ ``` | ||
`csv-parser` can convert CSV into JSON at at rate of around 90,000 rows per second (perf varies with data, try `bench.js` with your data). | ||
## Usage | ||
@@ -17,2 +19,4 @@ | ||
You can use `csv-parser` in the browser with [browserify](http://browserify.org/) | ||
``` js | ||
@@ -19,0 +23,0 @@ var csv = require('csv-parser') |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
13737
373
59
0
5
+ Addedgenerate-function@^1.0.1
+ Addedgenerate-function@1.1.0(transitive)