(
blocks: readonly { readonly type: string }[],
separator = '',
)
| 2960 | * and their readonly/DeepImmutable variants via structural typing. |
| 2961 | */ |
| 2962 | export function extractTextContent( |
| 2963 | blocks: readonly { readonly type: string }[], |
| 2964 | separator = '', |
| 2965 | ): string { |
| 2966 | return blocks |
| 2967 | .filter((b): b is { type: 'text'; text: string } => b.type === 'text') |
| 2968 | .map(b => b.text) |
| 2969 | .join(separator) |
| 2970 | } |
| 2971 | |
| 2972 | export function getContentText( |
| 2973 | content: string | DeepImmutable<Array<ContentBlockParam>>, |
no outgoing calls
no test coverage detected