isValidRollConvention
Signature
Section titled “Signature”isValidRollConvention(convention: unknown): convention is RollConventionReturn true when convention is a RollConvention that rollDate implements.
- Valid conventions are
"following","modifiedFollowing","preceding","modifiedPreceding","endOfMonth"and"none". The first three are the conventions ISDA 2006 Definitions §4.12(a) defines in (i)–(iii);"modifiedPreceding"is FpML’sBusinessDayConventionEnumMODPRECEDING, which §4.12(a) does not define;"none"is Strata’sNO_ADJUST; and"endOfMonth"is GMT’s own. The camelCase spelling is GMT’s — no standard fixes the identifiers, only the behaviour. - Matching is exact: case, spacing and abbreviations are not normalised.
- Accepts any input type and returns false for non-string values.
rollDatereturns""for a convention it does not recognise — the same sentinel it returns for a bad date or calendar. Check the convention here to tell a misconfigured contract term apart from bad data.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
convention | unknown | candidate value of any type |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidRollConvention } from "@northguild/gmt/calendar/validate";
isValidRollConvention("modifiedFollowing") // true