MCPcopy Create free account
hub / github.com/pollinations/pollinations / truncateString

Function truncateString

shared/error.ts:494–501  ·  view source on GitHub ↗
(
    value: string | undefined,
    maxLength: number,
)

Source from the content-addressed store, hash-verified

492}
493
494function truncateString(
495 value: string | undefined,
496 maxLength: number,
497): string | undefined {
498 if (!value) return undefined;
499 if (value.length <= maxLength) return value;
500 return `${value.slice(0, maxLength)}...`;
501}

Callers 3

ensureUpstreamOkFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected