Function
truncateCode
(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 = |
Tested by
no test coverage detected