FieldMap

FieldMap

new FieldMap(options)

Description:
  • Used to declare the position of a field in a segment to a json object key value.
Source:
Examples
const fieldMap = new FieldMap({
 segmentIdentifier: "W07",
identifierValue: null,
identifierPosition: null,
valuePosition: 4,
});
const newObjectToMapFieldsTo = {
 itemCode: new FieldMap({
   segmentIdentifier: "W07",
   identifierValue: null,
   identifierPosition: null,
  valuePosition: 4,
 }),
 lotCode: new FieldMap({
   segmentIdentifier: "W07",
   identifierValue: null,
   identifierPosition: null,
   valuePosition: 7,
 }),
};
Parameters:
Name Type Description
options Object
Properties
Name Type Description
segmentIdentifier String The segment identifier.
identifierValue String The value of the field identifier.
identifierPosition Number The position of the field identifier.
valuePosition Number The position of the field value.

Methods

(static) toJSON() → {Object}

Description:
  • Returns a JSON representation of the FieldMap.
Source:
Example
const json = fieldMap.toJSON();
console.log(json);
// {
//   segmentIdentifier: "W07",
//   identifierValue: null,
//   identifierPosition: null,
//   valuePosition: 4,
// }
Returns:
Type
Object