Permalink
Browse files

Update lazy.js

  • Loading branch information...
critium committed Mar 13, 2012
1 parent a99d409 commit 848eaec766654c3fa4d11fc2665bde861b5758b4
Showing with 5 additions and 1 deletion.
  1. +5 −1 lazy.js
View
@@ -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

This comment has been minimized.

Show comment
Hide comment
@critium

critium Mar 13, 2012

Owner

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

Owner

critium commented on 848eaec Mar 13, 2012

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

Please sign in to comment.