# millify

> Converts long numbers to pretty, human-readable strings

Latest version **6.1.0** (published 2023-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install millify
pnpm add millify
yarn add millify
bun add millify
```

Provides the command `millify`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.1.0 |
| Published | 2023-03-12 |
| First published | 2015-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 183 |
| Author | izolate |
| Maintainers | izolate |
| Keywords | big, large, numbers, short, pretty, human, format, readable, simplify, beautify, thousand, million, billion, trillion, millify |

## Links

- npm: https://www.npmjs.com/package/millify
- Repository: https://github.com/izolate/millify
- Homepage: https://github.com/izolate/millify#readme
- Issues: https://github.com/izolate/millify/issues
- npm.io page: https://npm.io/package/millify

## Dependencies (1)

- [yargs](https://npm.io/package/yargs.md) ^17.0.1

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 6.1.0 (latest) — 2023-03-12
- 6.0.2 — 2023-03-12
- 6.0.1 — 2023-03-12
- 5.0.1 — 2022-09-11
- 5.0.0 — 2022-07-24
- 4.0.1 — 2022-07-24
- 4.0.0 — 2021-05-20
- 3.5.2 — 2021-04-08
- 3.5.1 — 2021-04-08
- 3.5.0 — 2020-12-31
- 3.4.0 — 2020-12-28
- 3.3.0 — 2020-07-25
- 3.2.1 — 2020-05-13
- 3.2.0 — 2020-05-13
- 3.1.6 — 2020-05-13
- … 9 more at https://npm.io/package/millify/versions

## README

# Millify

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'`


## Install

Get it on [npm](https://www.npmjs.com/package/millify):

```bash
npm install millify
```
## Usage

### Command line

```bash
$ millify 12345
12.3K
```

See `millify --help` for options.

### Programmatically

#### `millify(value: number, options: MillifyOptions)`

```js
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
```

## Options

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

---
_Source: https://npm.io/package/millify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
