MCPcopy
hub / github.com/claude-code-best/claude-code / escapeJsLineTerminators

Function escapeJsLineTerminators

src/cli/ndjsonSafeStringify.ts:18–22  ·  view source on GitHub ↗
(json: string)

Source from the content-addressed store, hash-verified

16const JS_LINE_TERMINATORS = /\u2028|\u2029/g
17
18function escapeJsLineTerminators(json: string): string {
19 return json.replace(JS_LINE_TERMINATORS, c =>
20 c === '\u2028' ? '\\u2028' : '\\u2029',
21 )
22}
23
24/**
25 * JSON.stringify for one-message-per-line transports. Escapes U+2028

Callers 1

ndjsonSafeStringifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected