Skip to main content
Version: v0.0.4

Function: applyAstmProfileToWarnings()

applyAstmProfileToWarnings(warnings, profile): AstmRecordWarning[]

Apply a profile across a whole warning list, returning a NEW array (the input is never mutated). Returned unchanged (same reference contents, a shallow copy) when profile is undefined, so the no-profile path pays only a copy. Every tolerated warning is re-badged; every other warning passes through by identity - nothing is dropped, reordered, or reallocated beyond the re-badge.

Parameters

warnings

readonly AstmRecordWarning[]

The accumulated record warnings.

profile

AstmProfile | undefined

The active profile, or undefined for no transform.

Returns

AstmRecordWarning[]

A new array with tolerated warnings downgraded.

Example

import { applyAstmProfileToWarnings, astmProfiles } from "@cosyte/astm";
const out = applyAstmProfileToWarnings(msgWarnings, astmProfiles.referenceCorpus);