• Split a code into a count and a unit, or null when nothing recognises it. For an indicator that knows its own interval and wants to reason about it, rather than hard-coding the handful of codes its author happened to test on.

    Read off the bucketing rule, not off the code's spelling, so it answers for a registered code the built-in grammar never parsed, and it answers canonically: 120m and 2h are the same bar and both read as 2 h. The coarsest unit that divides the length wins, which is also why a 90-second bar reads as 90 s rather than as one and a half minutes.

    Parameters

    • code: string

    Returns IntervalParts | null