Skip to main content
Version: v0.0.2

Function: partitionWarnings()

partitionWarnings(warnings, profile): X12WarningPartition

Split a parse's warnings against a profile's expected-warning union. A warning whose code is in the profile's expectedWarnings lands in expected; everything else lands in unexpected. Order within each bucket preserves the input order.

Parameters

warnings

readonly X12ParseWarning[]

profile

X12Profile

Returns

X12WarningPartition

Example

import { parseX12, partitionWarnings, profiles } from "@cosyte/x12";
const ix = parseX12(raw, { profile: profiles.availity });
const { expected, unexpected } = partitionWarnings(ix.warnings, profiles.availity);
if (unexpected.length > 0) flagForReview(unexpected);