MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / truncateCode

Function truncateCode

packages/plugin-ui/src/components/CodePanel.tsx:67–73  ·  view source on GitHub ↗
(codeString: string, lines: number)

Source from the content-addressed store, hash-verified

65
66 // Function to truncate code to a specific number of lines
67 const truncateCode = (codeString: string, lines: number) => {
68 const codeLines = codeString.split("\n");
69 if (codeLines.length <= lines) {
70 return codeString;
71 }
72 return codeLines.slice(0, lines).join("\n") + "\n...";
73 };
74
75 // If the selected framework is Tailwind and a prefix is provided then transform the code.
76 const prefixedCode =

Callers 1

CodePanelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected