MCPcopy Index your code
hub / github.com/cli-table/cli-table3 / truncateWidth

Function truncateWidth

src/utils.js:143–153  ·  view source on GitHub ↗
(str, desiredLength)

Source from the content-addressed store, hash-verified

141}
142
143function truncateWidth(str, desiredLength) {
144 if (str.length === strlen(str)) {
145 return str.substr(0, desiredLength);
146 }
147
148 while (strlen(str) > desiredLength) {
149 str = str.slice(0, -1);
150 }
151
152 return str;
153}
154
155function truncateWidthWithAnsi(str, desiredLength) {
156 let code = codeRegex(true);

Callers 1

truncateWidthWithAnsiFunction · 0.85

Calls 1

strlenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…