MCPcopy
hub / github.com/lingodotdev/lingo.dev / getFirstJsx

Function getFirstJsx

packages/compiler/src/utils/hash.spec.ts:7–20  ·  view source on GitHub ↗
(pathCode: string)

Source from the content-addressed store, hash-verified

5import { getJsxElementHash, getJsxAttributeValueHash } from "./hash";
6
7function getFirstJsx(pathCode: string) {
8 const payload = createPayload({
9 code: pathCode,
10 params: {} as any,
11 relativeFilePath: "x.tsx",
12 });
13 let found: any;
14 traverse(payload.ast, {
15 JSXElement(p) {
16 if (!found) found = p;
17 },
18 });
19 return found as any;
20}
21
22describe("utils/hash", () => {
23 describe("getJsxElementHash", () => {

Callers 1

hash.spec.tsFile · 0.85

Calls 2

createPayloadFunction · 0.90
traverseFunction · 0.50

Tested by

no test coverage detected