* Filter blocks by type if --type option is provided.
(blocks: DeepnoteBlock[], options: CatOptions)
| 229 | * Filter blocks by type if --type option is provided. |
| 230 | */ |
| 231 | function filterBlocks(blocks: DeepnoteBlock[], options: CatOptions): DeepnoteBlock[] { |
| 232 | if (!options.type) { |
| 233 | return blocks |
| 234 | } |
| 235 | |
| 236 | const typeFilter = options.type.toLowerCase() |
| 237 | |
| 238 | // Handle category filters |
| 239 | if (typeFilter === 'text') { |
| 240 | return blocks.filter(b => b.type.startsWith('text-cell-')) |
| 241 | } |
| 242 | if (typeFilter === 'input') { |
| 243 | return blocks.filter(b => b.type.startsWith('input-')) |
| 244 | } |
| 245 | |
| 246 | return blocks.filter(b => b.type === typeFilter) |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Get the content of a block. |
no outgoing calls
no test coverage detected