MCPcopy Create free account
hub / github.com/Effect-TS/effect / stripControlCharacters

Function stripControlCharacters

packages/printer/src/internal/doc.ts:827–839  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

825}
826
827const stripControlCharacters = (value: string): string => {
828 let sanitized = ""
829 for (let i = 0; i < value.length; i++) {
830 const code = value.charCodeAt(i)
831 if (
832 (code > 0x1f || code === 0x09 || code === 0x0a) &&
833 (code < 0x7f || code > 0x9f)
834 ) {
835 sanitized += value[i]
836 }
837 }
838 return sanitized
839}
840
841const sanitizeLeaf = <A>(self: Doc.Char<A> | Doc.Text<A>): Doc.Doc<A> => {
842 const value = self._tag === "Char" ? self.char : self.text

Callers 1

sanitizeLeafFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected