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 / hooks / views / detail / hunk-source-of / hunk-source-of.ts
11 lines · 362 BRaw
1import type Git from '../../../git'
2import { hunkHeaderOf } from '../hunk-header-of'
3
4/**
5 * A hunk as unified-diff text: its header (hunkHeaderOf), then its lines.
6 *
7 * @param hunk the hunk, its lines body lines only
8 * @returns the text, no trailing newline
9 */
10export const hunkSourceOf = (hunk: Git.Hunk) =>
11 [hunkHeaderOf(hunk), ...hunk.lines].join('\n')