MCPcopy Index your code
hub / github.com/simstudioai/sim / truncateString

Function truncateString

apps/sim/stores/terminal/console/utils.ts:29–38  ·  view source on GitHub ↗

* Truncates a string while preserving a short explanation.

(
  value: string,
  maxLength: number = TERMINAL_CONSOLE_LIMITS.MAX_STRING_LENGTH
)

Source from the content-addressed store, hash-verified

27 * Truncates a string while preserving a short explanation.
28 */
29function truncateString(
30 value: string,
31 maxLength: number = TERMINAL_CONSOLE_LIMITS.MAX_STRING_LENGTH
32): string {
33 if (value.length <= maxLength) {
34 return value
35 }
36
37 return `${value.slice(0, maxLength)}... [truncated ${value.length - maxLength} chars]`
38}
39
40/**
41 * Safely stringifies terminal data without throwing on circular or non-JSON-safe values.

Callers 3

normalizeConsoleValueFunction · 0.70
capNormalizedValueFunction · 0.70
normalizeConsoleErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected