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 / telemetry / hooks / entries / wire-of / wire-of.ts
24 lines · 736 BRaw
1import { isRecord } from '../is-record'
2
3/**
4 * A value with every object key respelled for the event-logging ingest:
5 * `platformRaw` as `platform_raw`, all the way down; arrays and leaves kept.
6 *
7 * @param value the row, or a part of it, keyed as the plugin builds it
8 * @returns the same value keyed as the ingest reads it
9 */
10export function wireOf(value: unknown): unknown {
11 const isList = Array.isArray(value)
12 const isObject = isRecord(value)
13
14 return isList
15 ? value.map(wireOf)
16 : isObject
17 ? Object.fromEntries(
18 Object.entries(value).map(([key, member]) => [
19 key.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`),
20 wireOf(member),
21 ]),
22 )
23 : value
24}