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

Function _removeLoneSurrogates

packages/core/src/logs/internal.ts:262–271  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

260 * Exported for testing
261 */
262export function _removeLoneSurrogates(str: string): string {
263 // isWellFormed/toWellFormed are ES2024 (not in our TS lib target), so we feature-detect via Object().
264 const strObj: Record<string, Function> = Object(str);
265 const isWellFormed = strObj['isWellFormed'];
266 const toWellFormed = strObj['toWellFormed'];
267 if (typeof isWellFormed === 'function' && typeof toWellFormed === 'function') {
268 return isWellFormed.call(str) ? str : toWellFormed.call(str);
269 }
270 return str;
271}

Callers 3

internal.test.tsFile · 0.90
_INTERNAL_captureLogFunction · 0.85
sanitizeLogAttributesFunction · 0.85

Calls 1

callMethod · 0.80

Tested by

no test coverage detected