Function: setDefaultProfile()
setDefaultProfile(
profile):void
Register a process-scoped default profile. parseScript(raw) /
parseTelecom(raw) (no explicit profile arg) consult getDefaultProfile()
and attach the returned profile to the result. Pass null (or undefined)
to clear.
Explicit args ALWAYS win: parseTelecom(raw, { profile: myProfile }) uses
myProfile regardless of the default; parseTelecom(raw, { profile: null })
opts out of the default for a single call without changing the registered
default.
Test hygiene: the only mutable module-scoped state in the library. Tests
that call this MUST clean up in afterEach (setDefaultProfile(null)).
Parameters
profile
NcpdpProfile | null
Returns
void
Example
import { setDefaultProfile, getDefaultProfile, profiles } from "@cosyte/ncpdp/profiles";
import { parseTelecom } from "@cosyte/ncpdp/telecom";
setDefaultProfile(profiles.pbm);
const tx = parseTelecom(raw);
tx.profile?.name; // "pbm"
setDefaultProfile(null); // clear (or in test teardown)