( ast: MessageFormatElement[], fn: (el: LiteralElement) => void )
| 10 | } from '@formatjs/icu-messageformat-parser' |
| 11 | |
| 12 | function forEachLiteralElement( |
| 13 | ast: MessageFormatElement[], |
| 14 | fn: (el: LiteralElement) => void |
| 15 | ): void { |
| 16 | ast.forEach(el => { |
| 17 | if (isLiteralElement(el)) { |
| 18 | fn(el) |
| 19 | } else if (isPluralElement(el) || isSelectElement(el)) { |
| 20 | for (const opt of Object.values(el.options)) { |
| 21 | forEachLiteralElement(opt.value, fn) |
| 22 | } |
| 23 | } else if (isTagElement(el)) { |
| 24 | forEachLiteralElement(el.children, fn) |
| 25 | } |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | /** @internal */ |
| 30 | export function generateXXLS( |
no test coverage detected