MCPcopy Create free account
hub / github.com/github/gh-aw / truncateString

Function truncateString

actions/setup/js/log_parser_shared.cjs:194–198  ·  view source on GitHub ↗

* Truncates a string to a maximum length with ellipsis * @param {string} str - The string to truncate * @param {number} maxLength - Maximum allowed length * @returns {string} Truncated string with ellipsis if needed

(str, maxLength)

Source from the content-addressed store, hash-verified

192 * @returns {string} Truncated string with ellipsis if needed
193 */
194function truncateString(str, maxLength) {
195 if (!str) return "";
196 if (str.length <= maxLength) return str;
197 return str.substring(0, maxLength) + "...";
198}
199
200/**
201 * Calculates approximate token count from text using 4 chars per token estimate

Callers 6

formatToolUseFunction · 0.85
formatCodexBashCallFunction · 0.85
formatMcpParametersFunction · 0.85
formatSafeOutputsPreviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected