Moved whitespace removal into push()
Showing
1 changed file
with
4 additions
and
1 deletions
... | @@ -70,7 +70,7 @@ | ... | @@ -70,7 +70,7 @@ |
70 | nextNewline = buffer.indexOf('\n'); | 70 | nextNewline = buffer.indexOf('\n'); |
71 | 71 | ||
72 | for (; nextNewline > -1; nextNewline = buffer.indexOf('\n')) { | 72 | for (; nextNewline > -1; nextNewline = buffer.indexOf('\n')) { |
73 | this.trigger('data', buffer.substring(0, nextNewline).replace(/^\s+|\s+$/g, '')); | 73 | this.trigger('data', buffer.substring(0, nextNewline)); |
74 | buffer = buffer.substring(nextNewline + 1); | 74 | buffer = buffer.substring(nextNewline + 1); |
75 | } | 75 | } |
76 | }; | 76 | }; |
... | @@ -108,6 +108,9 @@ | ... | @@ -108,6 +108,9 @@ |
108 | */ | 108 | */ |
109 | ParseStream.prototype.push = function(line) { | 109 | ParseStream.prototype.push = function(line) { |
110 | var match, event; | 110 | var match, event; |
111 | |||
112 | //strip whitespace | ||
113 | line = line.replace(/^\s+|\s+$/g, ''); | ||
111 | if (line.length === 0) { | 114 | if (line.length === 0) { |
112 | // ignore empty lines | 115 | // ignore empty lines |
113 | return; | 116 | return; | ... | ... |
-
Please register or sign in to post a comment