(key: string, raw: unknown)
| 121 | } |
| 122 | |
| 123 | function formatPair(key: string, raw: unknown): string { |
| 124 | const limited = truncate(serializeValue(raw), CTX_VALUE_MAX_CHARS); |
| 125 | const renderedKey = SAFE_KEY_RE.test(key) ? key : quote(key); |
| 126 | const renderedVal = /[\s="\\]/.test(limited) || limited.length === 0 ? quote(limited) : limited; |
| 127 | return `${renderedKey}=${renderedVal}`; |
| 128 | } |
| 129 | |
| 130 | function clipBytes(text: string, maxBytes: number): string { |
| 131 | if (Buffer.byteLength(text, 'utf-8') <= maxBytes) return text; |
no test coverage detected