mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
The worst cases the audit named: docstrings and header comments that told how three old copies drifted, or quoted subprocess counts that were stale the day they were written, instead of stating the contract. Each now says what the function does and keeps one line of why. Also drops the always-zero n_cloud counter that existed only to keep a boot log line's or-chain intact.
25 lines
918 B
JavaScript
25 lines
918 B
JavaScript
// Number formatting helpers for KPI tiles and count badges.
|
|
//
|
|
// `formatCompact` renders large counts in a space-tight notation (107814 ->
|
|
// "107.8K") so a 6-digit total never bursts a narrow tile; `formatFull` is the
|
|
// grouped exact form (107814 -> "107,814") used as the hover title so the
|
|
// precise count stays one hover away. Non-finite / non-numeric input is
|
|
// returned unchanged, letting callers pass placeholders like an em dash
|
|
// straight through.
|
|
|
|
import { formatCompactNumber, formatNumber } from './intl.js';
|
|
|
|
export function formatCompact(value) {
|
|
const n = typeof value === 'number' ? value : Number(value);
|
|
if (!Number.isFinite(n)) return value;
|
|
return formatCompactNumber(n);
|
|
}
|
|
|
|
export function formatFull(value) {
|
|
const n = typeof value === 'number' ? value : Number(value);
|
|
if (!Number.isFinite(n)) return value;
|
|
return formatNumber(n);
|
|
}
|
|
|
|
export default formatCompact;
|