MCPcopy Index your code
hub / github.com/codeaashu/claude-code / formatInstallCount

Function formatInstallCount

src/utils/plugins/installCounts.ts:273–292  ·  view source on GitHub ↗
(count: number)

Source from the content-addressed store, hash-verified

271 * - >=1000000: M suffix with 1 decimal (e.g., "1.2M")
272 */
273export function formatInstallCount(count: number): string {
274 if (count < 1000) {
275 return String(count)
276 }
277
278 if (count < 1000000) {
279 const k = count / 1000
280 // Use toFixed(1) but remove trailing .0
281 const formatted = k.toFixed(1)
282 return formatted.endsWith('.0')
283 ? `${formatted.slice(0, -2)}K`
284 : `${formatted}K`
285 }
286
287 const m = count / 1000000
288 const formatted = m.toFixed(1)
289 return formatted.endsWith('.0')
290 ? `${formatted.slice(0, -2)}M`
291 : `${formatted}M`
292}
293

Callers 2

BrowseMarketplaceFunction · 0.85
DiscoverPluginsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected