
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Converts long numbers
into pretty, human-readable strings
.
Before :unamused: | After :tada: |
---|---|
2000 | '2K' |
10000 | '10k' |
42500 | '42.5 kg' |
1250000 | '1.25 MB' |
2700000000 | '2.7 bil' |
Get it on npm:
npm install millify
$ millify 12345
12.3K
See millify --help
for options.
millify(value: number, options: MillifyOptions)
import millify from "millify";
// For CommonJS: `const { millify } = require("millify");`
millify(2500); // 2.5K
millify(1024000, {
precision: 3,
lowercase: true
});
// 1.024m
millify(39500, {
precision: 2,
locales: "de-DE"
});
// 3,95K
millify(1440000, {
units: ["B", "KB", "MB", "GB", "TB"],
space: true,
});
// 1.44 MB
Name | Type | Default | Description |
---|---|---|---|
precision | number | 1 | Number of decimal places to use |
locales | string | Array<string> | browser language | Formats the number in different languages |
lowercase | boolean | false | Use lowercase abbreviations |
space | boolean | false | Add a space between number and abbreviation |
units | Array<string> | ['', 'K', 'M', 'B', 'T', 'P', 'E'] | Unit abbreviations |
[6.1.0] - 2023-03-11
navigator.languages
FAQs
Converts long numbers to pretty, human-readable strings
The npm package millify receives a total of 78,680 weekly downloads. As such, millify popularity was classified as popular.
We found that millify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.