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

Function heldBinding

src/resolution/frameworks/react.ts:865–871  ·  view source on GitHub ↗

* The binding a value holds and nothing more — `AvatarWithHoverCard` of * outline's `const Avatar = AvatarWithHoverCard`, past a type assertion (`= * Page as FC`) — or null for any other initializer.

(value: Node, context: ResolutionContext)

Source from the content-addressed store, hash-verified

863 * Page as FC`) — or null for any other initializer.
864 */
865function heldBinding(value: Node, context: ResolutionContext): string | null {
866 const code = stripCommentsForRegex(declarationText(value, context), 'typescript');
867 const init = initializerAt(code, value.name.length);
868 if (init < 0) return null;
869 const held = /^\s*([A-Za-z_$][\w$]*)\s*(?:$|(?:as|satisfies)\s)/.exec(code.slice(init, statementEnd(code, init)));
870 return held && held[1] !== value.name ? held[1]! : null;
871}
872
873/**
874 * The component of its own file a wrapper call around a declaration hands

Callers 1

exportedComponentFunction · 0.85

Calls 5

stripCommentsForRegexFunction · 0.90
initializerAtFunction · 0.85
declarationTextFunction · 0.70
statementEndFunction · 0.70
execMethod · 0.65

Tested by

no test coverage detected