This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
X12Parser API
Josh Johnson edited this page Apr 19, 2016
·
2 revisions
When constructing an instance of X12Parser
, you must specify if parsing should be strict or not. When strict parsing is enabled, a ParserError
will be thrown if there are any syntax issues or X12 standards issues (such as a control number mismatch). Otherwise, these errors will simply be tracked in the diagnostics
property of the parser instance.
constructor(private _strict: boolean) { }
Property | Type | Notes |
---|---|---|
diagnostics |
X12Diagnostic[] |
A collection of diagnostics accumulated while parsing the raw X12 data. |
Method | Returns | Notes |
---|---|---|
parseX12(edi: string) |
X12Interchange |
The input X12 data must contain a valid envelope (ISA/IEA, GS/GE segments). |
import { X12Parser } from 'x12/core';
let rawEDI = '...';
let parser = new X12Parser(false);
let interchange = parser.parseX12(rawEDI);
if (parser.diagnostics.length > 0) {
// do something about the syntax errors
}