1.1.1Edi this class serves as an Edi writer
before writing a new message, you must call the .reset method
for internal use only
(any)
remove the leading,trailing and LF in order to be complient with EDIFACT EDIFACT strings are multiline in the test only for readability
(any)
return a Date from an edi date str compatible with SQL
(any)
convert dt to an datetime string YYYY-MM-DD HH:MM:SS
(any)
can either be an element
['YYYYMMD','HHMM']
or a YYYYMMDDHHMM string
reset this method clear the current edifact string and reset the internal state of Edi
it has to be called before any new message.
writeSegement
write a segment of name segment with a number of elements.
if an element is a complex element (= with more than one component),
all components should be passed as an array.
If an element must be empty, pass undefined if this is not the last defined element.
(any)
{string} the name of the segment (3 UpperCase chars)
(...any)
{... string | array}
let edi = new Edi();
edi.writeSegment('UNB',['UNOC',1],'WS','ESTORE','NOV',['20181001','1255'],'253006',undefined,'ESTORE');
for internal use only
(any)
for internal use only
(any)
Segment this class represent a segment with all elements / component
(any)
return the value of a given element/component of the segment if the element or component doen't exist, return undefined.
(int)
the number of the element of the segment
(int)
the number of the compenent of the element or undefined if all components must be returned
Message The super class for all message interpreters.
Implement the mechanism of message interpretation but does noting in itself since it has no implementation of any segment
(any)
(any)
(any)
reset is called at the beginning of interpret and must clear all previous data.
should be overwritten by the class that extends Message
throw an error if variable has not an expected value
variable = the variable to check values an expected value or an array of expected value. if undefined, doesn't check, just print the message
returns variable if everything ok
(any)
(any)
(any)
check that a given component has a given value or is in a given set of values
(any)
of the current segment
(any)
in the element
(any)
either a string or an array of string
set a property if the given element / component is defined
(object)
the object to set a property
(string)
the property name
(number)
the element number of the current segment
(number)
the number of the component to look for.
if undefined, the array of components is put into the property
if either the element or element.component of the _currentSegment is undefined, nothing is done
understand the previous segment and open a new one in order to collect elements
(any)
name of the segment
Order16033 a parser for ORDERS according to ISO16033
Extends Message
reset must be call before interpreting a new message.