MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / trimTrailingNodes

Function trimTrailingNodes

cli/src/utils/markdown-renderer.tsx:140–149  ·  view source on GitHub ↗
(
  nodes: ReactNode[],
  predicate: (node: ReactNode) => boolean,
)

Source from the content-addressed store, hash-verified

138
139// Unified trim helper with predicate
140const trimTrailingNodes = (
141 nodes: ReactNode[],
142 predicate: (node: ReactNode) => boolean,
143): ReactNode[] => {
144 let end = nodes.length
145 while (end > 0 && predicate(nodes[end - 1])) {
146 end -= 1
147 }
148 return end === nodes.length ? nodes : nodes.slice(0, end)
149}
150
151const trimTrailingWhitespaceNodes = (nodes: ReactNode[]): ReactNode[] => {
152 return trimTrailingNodes(

Callers 2

trimTrailingBreaksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected