MCPcopy
hub / github.com/chartbrew/chartbrew / truncateString

Function truncateString

server/modules/updateAudit.js:47–58  ·  view source on GitHub ↗
(value, maxLength = DEFAULT_MAX_STRING_LENGTH)

Source from the content-addressed store, hash-verified

45}
46
47function truncateString(value, maxLength = DEFAULT_MAX_STRING_LENGTH) {
48 if (value === undefined || value === null) {
49 return value;
50 }
51
52 const stringValue = String(value);
53 if (stringValue.length <= maxLength) {
54 return stringValue;
55 }
56
57 return `${stringValue.slice(0, maxLength)}...[truncated]`;
58}
59
60function collapseWhitespace(value) {
61 return String(value || "")

Callers 5

sanitizePayloadFunction · 0.85
sanitizeSnippetFunction · 0.85
sanitizeRouteSnippetFunction · 0.85
sanitizeQueryPreviewFunction · 0.85
normalizeErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected