MCPcopy Create free account
hub / github.com/codename-co/stack / formatSize

Function formatSize

packages/website/src/helpers/format.ts:1–16  ·  view source on GitHub ↗
(size?: number, lang?: string)

Source from the content-addressed store, hash-verified

1export const formatSize = (size?: number, lang?: string) => {
2 if (!size) {
3 return "Unknown";
4 }
5
6 return Intl.NumberFormat(lang, {
7 minimumFractionDigits: 2,
8 maximumFractionDigits: 2,
9 notation: "compact",
10 trailingZeroDisplay: "stripIfInteger",
11
12 style: "unit",
13 unit: "byte",
14 unitDisplay: "narrow",
15 }).format(size);
16};
17
18export const formatStars = (stars?: number, lang?: string) => {
19 if (!stars) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected