diff --git a/History.md b/History.md
index ad8a1fb9..e6750f42 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,7 @@
+# v0.5.1
+
+* Fixed issue where line data was not being passed between transforms in the parser_stream
+
# v0.5.0
* Added support for async transforms [#24](https://github.com/C2FO/fast-csv/issues/24)
diff --git a/docs/History.html b/docs/History.html
index c104132c..c92e7a16 100644
--- a/docs/History.html
+++ b/docs/History.html
@@ -176,6 +176,10 @@
+
v0.5.1
+
+- Fixed issue where line data was not being passed between transforms in the parser_stream
+
v0.5.0
- Added support for async transforms #24
diff --git a/lib/parser/parser_stream.js b/lib/parser/parser_stream.js
index 6d731faa..1eadbc67 100644
--- a/lib/parser/parser_stream.js
+++ b/lib/parser/parser_stream.js
@@ -165,20 +165,24 @@ extended(ParserStream).extend({
},
_parse: function _parseLine(data, hasMoreData, cb) {
- var row, count, ret, rows, self = this;
+ var rows, self = this;
try {
data = this.parser(data, hasMoreData);
rows = data.rows;
- if (!this._parsedHeaders) {
- this.__processHeaders(rows, function (err) {
- if (err) {
- cb(err);
- } else {
- self.__processRows(rows, data, cb);
- }
- });
+ if (rows.length) {
+ if (!this._parsedHeaders) {
+ this.__processHeaders(rows, function (err) {
+ if (err) {
+ cb(err);
+ } else {
+ self.__processRows(rows, data, cb);
+ }
+ });
+ } else {
+ this.__processRows(rows, data, cb);
+ }
} else {
- this.__processRows(rows, data, cb);
+ cb(null, data.line);
}
} catch (e) {
this.emit("error", e);
diff --git a/package.json b/package.json
index 201f69c4..3178bbc8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fast-csv",
- "version": "0.5.0",
+ "version": "0.5.1",
"description": "CSV parser and writer",
"main": "index.js",
"scripts": {