* Flatten a choice group's `Properties` into an ordered list of branch property * objects. The parser encodes `a // b` as a mix of array-wrapped and bare * elements; both are choice alternatives here.
(properties)
| 277 | * elements; both are choice alternatives here. |
| 278 | */ |
| 279 | function choiceBranches(properties) { |
| 280 | const branches = [] |
| 281 | for (const element of properties ?? []) { |
| 282 | if (Array.isArray(element)) branches.push(...element.filter((e) => e && typeof e === 'object')) |
| 283 | else if (element && typeof element === 'object') branches.push(element) |
| 284 | } |
| 285 | return branches |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * Detect a record with an inline variant choice: exactly one anonymous property |
no test coverage detected