Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed 'strDelimiter' option not being used in .each and .parse function

  • Loading branch information...
commit 925dcc2040b808c7e9e6a59e286d670e35e1161b 1 parent ac2e136
@robofish authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/csv.js
View
5 lib/csv.js
@@ -116,7 +116,7 @@ exports.each = function (filename, options) {
var stream = new events.EventEmitter();
var emit_row = function(row) {
- var data = CSVToArray(row)[0];
+ var data = CSVToArray(row, strDelimiter)[0];
if (options["headers"]) {
if (headers == null) {
headers = data;
@@ -181,13 +181,14 @@ exports.parse = function(str, options, data_listener) {
throw new Exception("Data listener must be provided");
}
options = (options || {});
+ var strDelimiter = (options.strDelimiter || ",");
var stream = new events.EventEmitter();
stream.addListener("data", data_listener);
var parts = str.split("\n");
var pl = parts.length;
var headers = null;
for( var i = 0; i < pl; i++) {
- var data = CSVToArray(parts[i])[0];
+ var data = CSVToArray(parts[i], strDelimiter)[0];
if (options["headers"]) {
if (headers == null) {
headers = data;
Please sign in to comment.
Something went wrong with that request. Please try again.