split2
Advanced tools
Comparing version 0.1.1 to 0.1.2
11
index.js
@@ -27,3 +27,3 @@ /* | ||
if (list.length >= 1) { | ||
this.push(this.mapper((this._last + list.shift()))) | ||
push(this, this.mapper((this._last + list.shift()))) | ||
} else { | ||
@@ -34,3 +34,3 @@ remaining = this._last + remaining | ||
for (i = 0; i < list.length; i++) { | ||
this.push(this.mapper(list[i])) | ||
push(this, this.mapper(list[i])) | ||
} | ||
@@ -45,3 +45,3 @@ | ||
if (this._last) | ||
this.push(this.mapper(this._last)) | ||
push(this, this.mapper(this._last)) | ||
@@ -51,2 +51,7 @@ cb() | ||
function push(self, val) { | ||
if (val !== undefined) | ||
self.push(val) | ||
} | ||
function noop(incoming) { | ||
@@ -53,0 +58,0 @@ return incoming |
{ | ||
"name": "split2", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "split a Text Stream into a Line Stream, using Stream 2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12
test.js
@@ -125,1 +125,13 @@ | ||
}) | ||
test('do not end on undefined', function(t) { | ||
t.plan(1) | ||
var input = split(function(line) {}) | ||
input.pipe(strcb(function(err, list) { | ||
t.deepEqual(list, []) | ||
})) | ||
input.end(new Buffer('hello\nworld')) | ||
}) |
Sorry, the diff of this file is not supported yet
253558
155