(raw: string)
| 53 | * self-correcting error on anything unrecognised. |
| 54 | */ |
| 55 | export function normalizeDateUnit(raw: string): StartOf { |
| 56 | const key = raw.trim().toLowerCase(); |
| 57 | const unit = UNIT_ALIASES[key]; |
| 58 | if (!unit) { |
| 59 | throw new Error( |
| 60 | `Unknown date unit "${raw.trim()}". Valid units: ${VALID_DATE_SNAP_UNITS}.`, |
| 61 | ); |
| 62 | } |
| 63 | return unit; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Parses a single pipe segment (already stripped of its leading `|`), e.g. |
no outgoing calls
no test coverage detected