MCPcopy Index your code
hub / github.com/deepnote/deepnote / filterBlocks

Function filterBlocks

packages/cli/src/commands/cat.ts:231–247  ·  view source on GitHub ↗

* Filter blocks by type if --type option is provided.

(blocks: DeepnoteBlock[], options: CatOptions)

Source from the content-addressed store, hash-verified

229 * Filter blocks by type if --type option is provided.
230 */
231function 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.

Callers 2

outputCatJsonFunction · 0.85
printBlocksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected