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

Function escapeControlCharacters

packages/effect/src/unstable/cli/CliOutput.ts:261–264  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

259export const layer = (formatter: Formatter): Layer.Layer<never> => Layer.succeed(Formatter)(formatter)
260
261const escapeControlCharacters = (text: string): string =>
262 // oxlint-disable-next-line no-control-regex
263 text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, (character) =>
264 `\\x${character.charCodeAt(0).toString(16).padStart(2, "0")}`)
265
266/**
267 * Creates a default formatter with configurable options.

Callers 1

defaultFormatterFunction · 0.85

Calls 2

toStringMethod · 0.65
replaceMethod · 0.45

Tested by

no test coverage detected