14 lines
601 B
JavaScript
14 lines
601 B
JavaScript
const { Reader } = require('ts-edifact');
|
|
const reader = new Reader();
|
|
|
|
const edi = "UNA:+.? 'UNB+UNOC:3+SENDER+RECEIVER+230226:1000+1'UNH+1+MSG:D:01A:UN'BGM+380+123+9'NAD+BY+00000::92++CB-Fenton F (US)+Center Rd+Fenton++48430+US'UNT+5+1'UNZ+1+1'";
|
|
try {
|
|
console.log('Testing string length:', edi.length);
|
|
console.log('Char at 179:', edi[179]); // In original test_efz it failed at 179
|
|
const segments = reader.parse(edi);
|
|
console.log('Successfully parsed', segments.length, 'segments.');
|
|
} catch (e) {
|
|
console.error('Error:', e.message);
|
|
if (e.stack) console.error(e.stack);
|
|
}
|