Skip to content
Browse files

Update lazy.js

  • Loading branch information...
1 parent a99d409 commit 848eaec766654c3fa4d11fc2665bde861b5758b4 @critium committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 lazy.js
View
6 lazy.js
@@ -184,7 +184,11 @@ function Lazy (em, opts) {
for (var i = 0; i < chunk.length; i++) {
if (chunk[i] === newline) {
// If we have content from the current chunk to append to our buffers, do it.
- if(i>0) chunkArray.push(chunk.slice(lastNewLineIndex, i));
+ if(i>0){
+ if(i === lastNewLineIndex){
+ lastNewLineIndex = i-1;
+ }
+ } chunkArray.push(chunk.slice(lastNewLineIndex, i));
// Wrap all our buffers and emit it.
this(mergeBuffers(chunkArray));

1 comment on commit 848eaec

@critium
Owner

very small change to fix "lines" returning "0" for newline only lines.

Please sign in to comment.
Something went wrong with that request. Please try again.