Skip to content

@ediocracy/parser/271 / functions

function

read271() ​

read271(transaction): Response271

Defined in: packages/parser/src/profiles/271/reader.ts:190

Reads one transaction set as a 271 eligibility response under the 005010X279A1 guide.

It does not check that the transaction set is a 271.

Parameters ​

ParameterTypeDescription
transactionTransactionA transaction set from readX12, such as document.interchanges[0].groups[0].transactions[0].

Returns ​

Response271

The response, with findings for anything that does not follow the guide.

Example ​

ts
import { readX12 } from '@ediocracy/parser';
import { read271 } from '@ediocracy/parser/271';

const transaction = readX12(text).interchanges[0]?.groups[0]?.transactions[0];
if (transaction) {
    const response = read271(transaction);
    console.log(response.sources.map((source) => source.name?.element(3)));
}