Function: defineLoopSpec()
defineLoopSpec(
input):LoopSpec
Define a TR3 loop specification. Validates structurally, freezes the
resulting LoopSpec (along with its segments and children
arrays), and returns it. Pure - no I/O, no global state.
Parameters
input
Returns
Example
import { defineLoopSpec } from "@cosyte/x12";
const Loop2110 = defineLoopSpec({
id: "2110",
description: "835 Service Payment Information",
trigger: "SVC",
segments: [
{ id: "SVC", usage: "required", max: 1 },
{ id: "DTM", usage: "situational", max: ">1" },
{ id: "CAS", usage: "situational", max: ">1" },
{ id: "REF", usage: "situational", max: ">1" },
{ id: "AMT", usage: "situational", max: ">1" },
{ id: "LQ", usage: "situational", max: ">1" },
],
});
Loop2110.trigger; // "SVC"