UnitFormat.js is a lightweight, dependency-free number formatter that converts raw numbers to human-readable strings with metric suffixes like 10km, 5GB, 17kHz, 220MW. Current stable version is 1.1.5 with a slow release cadence. It supports base-10 and base-2 prefixes, custom unit strings, and configurable suffix lists. Differentiators include zero dependencies, TypeScript type definitions, and a single-function API that is easy to embed in browser or Node.js projects. Unlike similar libraries, it does not handle locale-specific formatting or significant figure rounding.
npm install unitformatNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic unit formatting with metric prefixes, custom base, and unit string.
Use `import unitFormat from 'unitformat'` or `const unitFormat = require('unitformat')`.Use `const unitFormat = require('unitformat')` and call `unitFormat(num, unit, prefixes, base)`.Validate input before calling unitFormat.
Use the correct case as documented.
Use `unitFormat` (lowercase) as the imported function.
Run `npm install unitformat` and ensure the import statement is correct.
Use `const unitFormat = require('unitformat').default` or configure bundler for ESM interop.No dependency data recorded yet.