spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / tests / fixtures / code-blocks-of / parsed-hunks-of.ts
12 lines · 448 BRaw
1import type Views from '../../../hooks/views'
2import { hunksOf } from './hunks-of.js'
3import type { ParsedHunk } from './parsed-hunk.js'
4
5/**
6 * Every hunk a body's `Code` blocks hold, in drawing order.
7 *
8 * @param body the file's body as `codeBlocksOf` cut it
9 * @returns the hunks read back out of each block's source
10 */
11export const parsedHunksOf = (body: Views.CodeBody): ParsedHunk[] =>
12 body.blocks.flatMap(block => hunksOf(block.source))