# cur

> It formats currency using Javascript

Latest version **1.0.3** (published 2017-10-20) · ISC license · 0 weekly downloads

## Install

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

## 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.0.3 |
| Published | 2017-10-20 |
| First published | 2017-09-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | aaron.jeffrey.ervin@gmail.com |
| Maintainers | aervin |
| Keywords | javascript, currency, usd, formatting, money, dollars |

## Links

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

## Dependencies (1)

- [buffered-reader](https://npm.io/package/buffered-reader.md) ^1.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2017-10-20
- 1.0.2 — 2017-09-30
- 1.0.1 — 2017-09-30

## README

[![CircleCI](https://circleci.com/gh/aervin/cur/tree/master.svg?style=shield)](https://circleci.com/gh/aervin/cur/tree/master)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
![minified](http://img.badgesize.io/aervin/cur/master/cur.js?label=minified)

# cur

If you want to format currency, it'll cost you 1kb.

### Installation:
```
npm i -S cur@latest
```
<br>


### Usage:
```
cur(
    figureToBeFormatted: number,
    returnDollarsAndCents: boolean, 
    config: { thousandsSeparator: string, decimalSeparator: string }
) => string | undefined
```
<br>


### Example with cents:
```
const cur = require('cur')
const dollars = 1234.56
const formattedDollars = cur(dollars, true)

console.log(`$${formattedDollars}`)
// =>  $1,234.56
```

### Example without cents:
```
import cur from 'cur'
const dollars = 1234.56
const formattedDollars = cur(dollars)

console.log(`$${formattedDollars}`)
// =>  $1,235
```

### Separators:
`cur` accepts an optional `config` argument with two properties, `thousandsSeparator` and `decimalSeparator`.
```
const formatCurrency = require('cur')
const config = { thousandsSeparator: "'", decimalSeparator: "," }
const amount = 1234.56
const formattedAmount = formatCurrency(amount, true, config)

console.log(formattedAmount)
// => 1'234,56
```

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