Download mods/diff/hooks/git/hunk-after.ts from SaylorTwift/claude-code: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/hooks/git/hunk-after.ts
- Command line
-
hf download hf://SaylorTwift/claude-code/mods/diff/hooks/git/hunk-after.ts
-
curl -L -o hunk-after.ts https://huggingface.co/SaylorTwift/claude-code/resolve/main/mods/diff/hooks/git/hunk-after.ts
664 Bytes
| import { countOf } from '../count-of' | |
| import type { Hunk } from './types' | |
| /** | |
| * The hunk less its first so many lines, its starts moved past them so | |
| * the numbers of the lines kept stay right; whole at 0. | |
| * | |
| * @param hunk the hunk, its lines body lines only | |
| * @param count how many leading lines to drop | |
| * @returns the rest of the hunk | |
| */ | |
| export function hunkAfter(hunk: Hunk, count: number): Hunk { | |
| const dropped = hunk.lines.slice(0, count) | |
| return { | |
| oldStart: hunk.oldStart + countOf(dropped, line => !line.startsWith('+')), | |
| newStart: hunk.newStart + countOf(dropped, line => !line.startsWith('-')), | |
| lines: hunk.lines.slice(count), | |
| } | |
| } | |