Function
parseDurationGroup
(group: string | undefined, isNegative: boolean)
Source from the content-addressed store, hash-verified
| 266 | } |
| 267 | |
| 268 | const parseDurationGroup = (group: string | undefined, isNegative: boolean): number => { |
| 269 | if (!group) { |
| 270 | return 0; |
| 271 | } |
| 272 | try { |
| 273 | const sign = isNegative ? -1 : 1; |
| 274 | return sign * Number(group.replace(',', '.')); |
| 275 | } catch { |
| 276 | throw new Error(`Invalid ISO 8601 Duration string: ${value}`); |
| 277 | } |
| 278 | }; |
| 279 | |
| 280 | const isNegative = !!match.groups?.negative; |
| 281 | |
Tested by
no test coverage detected