Trim whitespace & newlines in line data before feeding it to the parser
Showing
1 changed file
with
1 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)); | 73 | this.trigger('data', buffer.substring(0, nextNewline).replace(/^\s+|\s+$/g, '')); |
74 | buffer = buffer.substring(nextNewline + 1); | 74 | buffer = buffer.substring(nextNewline + 1); |
75 | } | 75 | } |
76 | }; | 76 | }; | ... | ... |
-
Please register or sign in to post a comment