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 / keeping.ts
17 lines · 334 BRaw
1/**
2 * A hook that keeps each input it is asked with, and answers, beside what
3 * it kept.
4 *
5 * @returns the hook, and each input in the order it came
6 */
7export function keeping<E>() {
8 const kept: E[] = []
9
10 function hook(_engine: unknown, e: E) {
11 kept.push(e)
12
13 return { value: undefined }
14 }
15
16 return { hook, kept }
17}