# @p12/numeral

> format number

Latest version **1.1.3** (published 2023-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @p12/numeral
pnpm add @p12/numeral
yarn add @p12/numeral
bun add @p12/numeral
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2023-01-12 |
| First published | 2022-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 28.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lincheng |
| Maintainers | shallowgreen, sixian.yu, linchengzzz, jerrywang959 |

## Links

- npm: https://www.npmjs.com/package/@p12/numeral
- Repository: https://github.com/ProjectTwelve/numeral
- Homepage: https://github.com/ProjectTwelve/numeral#readme
- Issues: https://github.com/ProjectTwelve/numeral/issues
- npm.io page: https://npm.io/package/@p12/numeral

## Dependencies (7)

- [tsdx](https://npm.io/package/tsdx.md) ^0.14.1
- [husky](https://npm.io/package/husky.md) ^8.0.1
- [tslib](https://npm.io/package/tslib.md) ^2.4.0
- [numeral](https://npm.io/package/numeral.md) ^2.0.6
- [size-limit](https://npm.io/package/size-limit.md) ^8.0.1
- [decimal.js-light](https://npm.io/package/decimal.js-light.md) ^2.5.1
- [@size-limit/preset-small-lib](https://npm.io/package/@size-limit/preset-small-lib.md) ^8.0.1

## Recent versions

- 1.1.3 (latest) — 2023-01-12
- 1.1.2 — 2022-12-26
- 1.1.1 — 2022-12-26
- 1.1.0 — 2022-11-25
- 1.0.2 — 2022-10-27
- 1.0.1 — 2022-10-27
- 1.0.0 — 2022-10-27

## README

# Numeral

> format number

## Install

```shell
npm install @p12/numeral
```

## How to use

### Format Props

| Name          | Type        | Default           | Description           |
|---------------|-------------|-------------------|-----------------------|
| type          | NumeralType | NumeralType.Token | format input          |
| decimalPlaces | number?     | undefined         | format decimal places |

### Numeral Type

```typescript
enum NumeralType {
  GameCoin,
  Token,
  Transfer,
  Balance,
  USD,
}
```

### Numeral

```typescript
import {numeral, NumeralType} from '@p12/numeral';

const format1 = numeral('1028').format(NumeralType.GameCoin); // 1.028K
const format2 = numeral('1028').format(NumeralType.GameCoin, 2); // 1.03K
```

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