MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / truncate

Function truncate

packages/core/src/utils/string.ts:13–18  ·  view source on GitHub ↗
(str: string, max: number = 0)

Source from the content-addressed store, hash-verified

11 * @returns string Encoded
12 */
13export function truncate(str: string, max: number = 0): string {
14 if (typeof str !== 'string' || max === 0) {
15 return str;
16 }
17 return str.length <= max ? str : `${str.slice(0, max)}...`;
18}
19
20/**
21 * This is basically just `trim_line` from

Callers 5

string.test.tsFile · 0.90
addBreadcrumbMethod · 0.90
applyClientOptionsFunction · 0.90
_extractErrorDataFunction · 0.90
formatIssueMessageFunction · 0.90

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected