Function: applyAstmProfile()
applyAstmProfile(
profile,warning):AstmRecordWarning
Apply a profile to a single warning. Returns a downgraded PROFILE_QUIRK_APPLIED
warning when the profile expects this deviation; otherwise returns the original
warning unchanged (referential identity preserved, so an un-tolerated warning is
never reallocated). A warning that is already expected (e.g. re-processed) is
passed through untouched.
Parameters
profile
The active profile.
warning
One accumulated warning.
Returns
The re-badged warning when tolerated, else the original.
Example
import { applyAstmProfile, astmProfiles, unknownEscapeSequence } from "@cosyte/astm";
const w = unknownEscapeSequence({ recordIndex: 4, recordType: "R", fieldIndex: 5 });
const out = applyAstmProfile(astmProfiles.referenceCorpus, w);
out.code; // "PROFILE_QUIRK_APPLIED"
out.toleratedCode; // "ASTM_UNKNOWN_ESCAPE_SEQUENCE"