MCPcopy Index your code
hub / github.com/deepnote/deepnote / truncate

Function truncate

packages/cli/src/utils/block-label.ts:153–158  ·  view source on GitHub ↗

* Truncate a string to max length, adding ellipsis if needed.

(str: string, maxLength: number)

Source from the content-addressed store, hash-verified

151 * Truncate a string to max length, adding ellipsis if needed.
152 */
153function truncate(str: string, maxLength: number): string {
154 if (str.length <= maxLength) {
155 return str
156 }
157 return `${str.slice(0, maxLength - 1)}…`
158}
159
160/**
161 * Get a shortened version of a block ID for display.

Callers 5

getAgentBlockLabelFunction · 0.85
getCodeBlockLabelFunction · 0.85
getSqlBlockLabelFunction · 0.85
getMarkdownBlockLabelFunction · 0.85
getTextCellLabelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected