Skip to main content
Version: v0.0.4

Function: orders()

orders(msg): readonly OrderRecord[]

Every order (O) record in the message, in wire order.

Parameters

msg

AstmMessage

A parsed single-message stream.

Returns

readonly OrderRecord[]

The order records (possibly empty).

Throws

AstmAmbiguousStreamError (ASTM_AMBIGUOUS_MULTI_MESSAGE) when the stream carries more than one message - see messages.

Example

import { parseAstmRecords, orders } from "@cosyte/astm";
const msg = parseAstmRecords("H|\\^&\rO|1|ACC-42||^^^687|R\rL|1\r");
orders(msg)[0]?.specimenId; // "ACC-42"