tdecaluwe / node-edifact

Javascript stream parser for UN/EDIFACT documents.
https://www.npmjs.com/package/edifact
Apache License 2.0
50 stars 13 forks source link

Fix two parsers with same encoding #31

Closed tmende closed 3 years ago

tmende commented 6 years ago

When instantiating two parsers with the same encoding, I get the following error, which is fixed by this pull request

        throw Parser.errors.invalidCharacter(chunk.charAt(index), index);
        ^

Error: Invalid character a at position 104
    at Object.invalidCharacter (sample/node_modules/edifact/parser.js:231:12)
    at Parser.write (sample/node_modules/edifact/parser.js:204:29)
    at Object.parse (sample/parser/sample.js:90:10)
    at sample (sample/test/helper/dumper.js:15:17)
    at Command.program.command.action (sample/test/helper/dumper.js:37:32)
    at Command.listener (sample/node_modules/commander/index.js:315:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (sample/node_modules/commander/index.js:651:12)
    at Command.parse (sample/node_modules/commander/index.js:474:21)