Skip to content

Commit

Permalink
Fix #17 by removing the break after UNA detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdecaluwe committed Mar 7, 2016
1 parent 709dbe9 commit a5c9047
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ "name": "edifact"
, "version": "1.2.5"
, "version": "1.2.6"
, "description": "JavaScript parser for UN/EDIFACT documents."
, "keywords": ["edifact", "edi", "eancom"]
, "main": "index.js"
Expand Down
5 changes: 4 additions & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ Parser.prototype.write = function (chunk) {
switch (this.state) {
case Parser.states.empty:
index = this.una(chunk) ? 9 : 0;
// If the first segment is interrupted by, for example, a line break, the
// parser will remain in the same state as it has here. Since we don't
// want the parser to detect another UNA header, in such a case, we put it
// in the segment state.
this.state = Parser.states.segment;
break;
case Parser.states.segment:
index = this._tokenizer.segment(chunk, index);
// Determine the next parser state.
Expand Down

0 comments on commit a5c9047

Please sign in to comment.