Skip to content

Commit

Permalink
fix for dep changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettl committed Sep 9, 2016
1 parent 2ed8081 commit 5355ba0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var removeHeaderRows = function (file, cb) {
let rows = data.split(lineChar);

let hRows = 0;
let cols = 0;
let cols = 0;
let exists = function (i) {
return i;
};
Expand Down Expand Up @@ -262,21 +262,23 @@ var _svToCSV = function (file, del, cb) { // eslint-disable-line no-underscore-d
.then(function (data) {
var def = q.defer();

// console.log(data)

csv.parse(data, {
delimiter: del
delimiter: del,
relax_column_count: true
}, function (err, rows) {
if (err) {
def.reject(err);
}

csv.stringify(rows, {}, function (err2, str) {
if (err2) {
def.reject(err2);
}

def.resolve(str);
});
} else {
csv.stringify(rows, {}, function (err2, str) {
if (err2) {
def.reject(err2);
}

def.resolve(str);
});
}
});

return def.promise;
Expand Down
4 changes: 4 additions & 0 deletions test/indexSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ describe('toCSV', function () {

describe(file, function () {
it(file + ' should convert to CSV without errors', function (done) {
this.timeout(3000);
assert.doesNotThrow(function () {

toCSV.httpHandler(
Expand All @@ -230,6 +231,9 @@ describe('toCSV', function () {
},
{ // Response
send: function (text) {
if (typeof text === 'object' && text instanceof Error) {
throw text;
}
csv.parse(text, function (err2, val) {
assert.ifError(err2);
assert(val);
Expand Down

0 comments on commit 5355ba0

Please sign in to comment.