MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / getNodeIndex

Function getNodeIndex

packages/cli/src/transform.ts:769–778  ·  view source on GitHub ↗
(node: any, edge: "start" | "end", lineStarts: number[])

Source from the content-addressed store, hash-verified

767}
768
769function getNodeIndex(node: any, edge: "start" | "end", lineStarts: number[]): number | null {
770 const direct = edge === "start" ? node.start : node.end;
771 if (typeof direct === "number") return direct;
772
773 const loc = node.loc?.[edge];
774 if (!loc) return null;
775 const lineIndex = lineStarts[loc.line - 1];
776 if (lineIndex == null) return null;
777 return lineIndex + loc.column;
778}
779
780function getSourceBetween(prevNode: any, nextNode: any, source?: string, lineStarts?: number[]): string {
781 if (!source) return "";

Callers 1

getSourceBetweenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected