MCPcopy Create free account
hub / github.com/bytebase/dbhub / fitString

Function fitString

src/utils/startup-table.ts:76–81  ·  view source on GitHub ↗

* Pad or truncate a string to fit a specific width

(str: string, width: number)

Source from the content-addressed store, hash-verified

74 * Pad or truncate a string to fit a specific width
75 */
76function fitString(str: string, width: number): string {
77 if (str.length > width) {
78 return str.slice(0, width - 1) + "…";
79 }
80 return str.padEnd(width);
81}
82
83/**
84 * Format host and database into a single string

Callers 1

generateStartupTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected