MCPcopy Create free account
hub / github.com/chakra-ui/panda / getNodeRange

Function getNodeRange

packages/extractor/src/get-node-range.ts:3–18  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

1import type { Node } from 'ts-morph'
2
3export const getNodeRange = (node: Node) => {
4 const src = node.getSourceFile()
5 const [startPosition, endPosition] = [node.getStart(), node.getEnd()]
6
7 const startInfo = src.getLineAndColumnAtPos(startPosition)
8 const endInfo = src.getLineAndColumnAtPos(endPosition)
9
10 return {
11 startPosition,
12 startLineNumber: startInfo.line,
13 startColumn: startInfo.column,
14 endPosition,
15 endLineNumber: endInfo.line,
16 endColumn: endInfo.column,
17 }
18}
19
20export type NodeRange = ReturnType<typeof getNodeRange>

Callers 1

box-factory.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected