MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / objectKeys

Function objectKeys

src/graph/branch-guards.ts:722–743  ·  view source on GitHub ↗

`{ email, password, …}` — the keys an object literal passes, not its bulk.

(node: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

720
721/** `{ email, password, …}` — the keys an object literal passes, not its bulk. */
722function objectKeys(node: SyntaxNode, source: string): string {
723 const keys: string[] = [];
724 let more = 0;
725 for (let i = 0; i < node.namedChildCount; i++) {
726 const c = node.namedChild(i);
727 if (!c || c.type === 'comment') continue;
728 let key: string | null = null;
729 if (c.type === 'pair') key = c.childForFieldName('key')?.text ?? null;
730 else if (c.type === 'shorthand_property_identifier' || c.type === 'shorthand_property_identifier_pattern') key = c.text;
731 else if (c.type === 'spread_element') key = collapse(c.text);
732 else if (c.type === 'method_definition') key = c.childForFieldName('name')?.text ?? null;
733 if (key === null) continue;
734 if (keys.length >= MAX_OBJECT_KEYS) {
735 more++;
736 continue;
737 }
738 keys.push(cut(key, 24));
739 }
740 void source;
741 if (keys.length === 0) return '{…}';
742 return `{ ${keys.join(', ')}${more > 0 ? ', …' : ''} }`;
743}
744
745// =============================================================================
746// Triggers — what fires a site

Callers 1

abbreviateArgumentFunction · 0.85

Calls 4

cutFunction · 0.85
pushMethod · 0.80
collapseFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected