(content: any)
| 56 | * Returns null if content is falsy. |
| 57 | */ |
| 58 | export function extractAdfText(content: any): string | null { |
| 59 | if (!content) return null |
| 60 | if (typeof content === 'string') return content |
| 61 | if (Array.isArray(content)) { |
| 62 | return content.map(extractAdfText).filter(Boolean).join(' ') |
| 63 | } |
| 64 | if (content.type === 'text') return content.text || '' |
| 65 | if (content.type === 'hardBreak') return '\n' |
| 66 | if (content.type === 'mention') return content.attrs?.text || '' |
| 67 | if (content.type === 'emoji') return content.attrs?.shortName || content.attrs?.text || '' |
| 68 | if (content.content) return extractAdfText(content.content) |
| 69 | return '' |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Transforms a raw Jira API user object into a typed user output. |
no test coverage detected