# @dwdarm/num-format

> Convert numbers like 1,000, 1,000,000, and 1,000,000,000 into the form of "1k", "1m", and "1b".

Latest version **1.1.1** (published 2020-07-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @dwdarm/num-format
pnpm add @dwdarm/num-format
yarn add @dwdarm/num-format
bun add @dwdarm/num-format
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-07-17 |
| First published | 2020-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Fajar Dwi Darmanto |
| Maintainers | dwdarm |

## Links

- npm: https://www.npmjs.com/package/@dwdarm/num-format
- Repository: https://github.com/dwdarm/num-format
- Homepage: https://github.com/dwdarm/num-format#readme
- Issues: https://github.com/dwdarm/num-format/issues
- npm.io page: https://npm.io/package/@dwdarm/num-format

## Recent versions

- 1.1.1 (latest) — 2020-07-17
- 1.1.0 — 2020-07-17
- 1.0.1 — 2020-03-06
- 1.0.0 — 2020-03-01

## README

# num-format
Convert numbers like 1,000, 1,000,000, and 1,000,000,000 into the form of "1k", "1m", and "1b".

## installation
```
npm install @dwdarm/num-format
```

## usage
```javascript
const numFormat = require('@dwdarm/num-format') 

// BASIC USAGE

// covert number 1000 to '1k'
numFormat(1000)
// '1k'

// covert number 1535 to '1.5k'
numFormat(1535)
// '1.5k'

// covert number 18000 to '18k'
numFormat(18000)
// '18k'

// covert number 180000 to '180k'
numFormat(180000)
// '180k'

// covert number 2000000 to '2m'
numFormat(2000000)
// '2m'

// covert number 5000000000 to '2b'
numFormat(2000000000)
// '2b'

// WITH OPTION

const option = {
  format: {
    k: ' thousand',
    m: ' million'
    b: ' billion'
  }
}

numFormat(1000, option) // '1 thousand'

numFormat(1000000, option) // '1 million'

numFormat(1000000000, option) // '1 billion'

```

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