Replace human-number with Intl.NumberFormat
Replaces the human-number dependency with native Intl.NumberFormat API using compact notation for number formatting with SI prefixes (K, M, B, T).
Changes
-
New utility: Created
formatCompactNumber(num, maximumFractionDigits)in UI utils (src/ui/scripts/utils/)- Uses
Intl.NumberFormatwithnotation: 'compact'andcompactDisplay: 'short' - Configurable decimal precision via
maximumFractionDigitsparameter
- Uses
-
Simplified formatters: Refactored
formatNumber.jsandformatFloat.jsto delegate to the shared utility -
Dependencies: Removed
human-numberfrom package.json
Example
// Before
import humanNumber from 'human-number'
const formatted = humanNumber(roundedNum, (num) => Number.parseFloat(num).toFixed(1))
const clean = formatted.replace('.0', '')
// After
import formatCompactNumber from './formatCompactNumber'
const formatted = formatCompactNumber(roundedNum, 1)
Output remains consistent: 1500 → "1.5K", 1000000 → "1M", 1500000000 → "1.5B"
> [!WARNING] > >
Original prompt
Replace human-number with Intl.RelativeTimeFormat. Create a reusable function when used multiple times. Add tests.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| ackee | Preview | Comment | Nov 10, 2025 11:36am |
@copilot Remove test/utils/formatCompactNumber.js and src/utils/formatCompactNumber.js
@copilot Remove test/utils/formatCompactNumber.js and src/utils/formatCompactNumber.js
Removed both files in commit 62a5203. The UI utility in src/ui/scripts/utils/formatCompactNumber.js remains and is used by formatNumber.js and formatFloat.js.
[!WARNING]
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fastdl.mongodb.org
- Triggering command:
node ./postinstall.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
- Configure Actions setup steps to set up my environment, which run before the firewall is enabled
- Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)