MCPcopy Create free account
hub / github.com/effect-app/libs / stripAnsi

Function stripAnsi

repos/effect/packages/effect/test/unstable/cli/Prompt.test.ts:23–41  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

21 let result = ""
22 let skipping = false
23 for (let index = 0; index < text.length; index++) {
24 const char = text[index]
25 if (skipping) {
26 if ((char >= "A" && char <= "Z") || (char >= "a" && char <= "z")) {
27 skipping = false
28 }
29 continue
30 }
31 if (char === escape) {
32 skipping = true
33 continue
34 }
35 result += char
36 }
37 return result
38}
39
40const toFrames = (lines: ReadonlyArray<unknown>) =>
41 lines
42 .map((line) => stripAnsi(String(line)))
43 .filter((line) => line.split(bell).join("").trim().length > 0)
44

Callers 2

toFramesFunction · 0.70
toRawFramesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…