MCPcopy Create free account
hub / github.com/codeaashu/claude-code / formatModelAndBilling

Function formatModelAndBilling

src/utils/logoV2Utils.ts:272–305  ·  view source on GitHub ↗
(
  modelName: string,
  billingType: string,
  availableWidth: number,
)

Source from the content-addressed store, hash-verified

270 * Determines how to display model and billing information based on available width
271 */
272export function formatModelAndBilling(
273 modelName: string,
274 billingType: string,
275 availableWidth: number,
276): {
277 shouldSplit: boolean
278 truncatedModel: string
279 truncatedBilling: string
280} {
281 const separator = ' · '
282 const combinedWidth =
283 stringWidth(modelName) + separator.length + stringWidth(billingType)
284 const shouldSplit = combinedWidth > availableWidth
285
286 if (shouldSplit) {
287 return {
288 shouldSplit: true,
289 truncatedModel: truncate(modelName, availableWidth),
290 truncatedBilling: truncate(billingType, availableWidth),
291 }
292 }
293
294 return {
295 shouldSplit: false,
296 truncatedModel: truncate(
297 modelName,
298 Math.max(
299 availableWidth - stringWidth(billingType) - separator.length,
300 10,
301 ),
302 ),
303 truncatedBilling: billingType,
304 }
305}
306
307/**
308 * Gets recent release notes for Logo v2 display

Callers 1

CondensedLogoFunction · 0.85

Calls 2

maxMethod · 0.80
truncateFunction · 0.70

Tested by

no test coverage detected