MCPcopy Create free account
hub / github.com/getsentry/sentry-javascript / utf8Bytes

Function utf8Bytes

packages/core/src/tracing/ai/messageTruncation.ts:63–65  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

61 * Calculate the UTF-8 byte length of a string.
62 */
63const utf8Bytes = (text: string): number => {
64 return new TextEncoder().encode(text).length;
65};
66
67/**
68 * Calculate the UTF-8 byte length of a value's JSON representation.

Callers 3

jsonBytesFunction · 0.85
truncateTextByBytesFunction · 0.85
truncateArrayMessageFunction · 0.85

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected