# currency-symbol-map

> A function to lookup the currency symbol for a given currency code

Latest version **5.1.0** (published 2022-05-29) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install currency-symbol-map
pnpm add currency-symbol-map
yarn add currency-symbol-map
bun add currency-symbol-map
```

## 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 | 5.1.0 |
| Published | 2022-05-29 |
| First published | 2014-02-05 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 341 |
| Author | Ben Gourley |
| Maintainers | bengourley, namenyi |
| Keywords | currency, symbol |

## Links

- npm: https://www.npmjs.com/package/currency-symbol-map
- Repository: https://github.com/bengourley/currency-symbol-map
- Homepage: https://github.com/bengourley/currency-symbol-map#readme
- Issues: https://github.com/bengourley/currency-symbol-map/issues
- npm.io page: https://npm.io/package/currency-symbol-map

## Recent versions

- 5.1.0 (latest) — 2022-05-29
- 5.0.1 — 2021-01-23
- 5.0.0 — 2021-01-23
- 4.0.4 — 2018-03-07
- 4.0.3 — 2017-10-10
- 4.0.2 — 2017-08-23
- 4.0.1 — 2017-05-30
- 4.0.0 — 2017-05-04
- 3.1.0 — 2016-10-25
- 3.0.2 — 2016-10-21
- 3.0.1 — 2016-08-11
- 3.0.0 — 2016-04-09
- 2.2.0 — 2016-02-19
- 2.1.0 — 2015-10-28
- 2.0.2 — 2015-03-23
- … 5 more at https://npm.io/package/currency-symbol-map/versions

## README

# currency-symbol-map

A function to lookup the currency symbol for a given currency code.

## Installation

    npm install currency-symbol-map

## Usage

### Get symbol from currency code
```js
// ES5
const getSymbolFromCurrency = require('currency-symbol-map')

// ES6
import getSymbolFromCurrency from 'currency-symbol-map'

getSymbolFromCurrency('GBP') //=> '£'
getSymbolFromCurrency('EUR') //=> '€'
getSymbolFromCurrency('USD') //=> '$'
getSymbolFromCurrency('NOT A VALID CODE') //=> undefined
```

### Exposed map for other processing
```js
// ES5
const currencyToSymbolMap = require('currency-symbol-map/map')

// ES6
import currencyToSymbolMap from 'currency-symbol-map/map'

console.log(currencyToSymbolMap)
// =>
{
 "USD": "$",
 "GBP": "£",
 …
}
```

## Tests
```bash
npm test
```

## Changelog

### 5.1.0
- Add CNH Currency mapping: [#82](https://github.com/bengourley/currency-symbol-map/pull/82)

### 5.0.1
- upgraded linter and improved code formatting ([#63](https://github.com/bengourley/currency-symbol-map/pull/63))

### 5.0.0
- added some missing currencies ([#61](https://github.com/bengourley/currency-symbol-map/pull/61))
- fixed the BTC symbol ([#50](https://github.com/bengourley/currency-symbol-map/pull/50))
- fixed the KZT symbol ([#52](https://github.com/bengourley/currency-symbol-map/pull/52))
- fixed the SGD symbol ([#55](https://github.com/bengourley/currency-symbol-map/pull/55))
- added TypeScript typings ([#53](https://github.com/bengourley/currency-symbol-map/pull/53))
- upgraded test libraries & added extra test cases ([#62](https://github.com/bengourley/currency-symbol-map/pull/62))

### 4.0.0
- the reverse lookup feature was removed (retrieving currency given a symbol) because
there is not a deterministic way to do so (i.e. the same symbol is used by multiple currencies).
- in previous versions, an unsuccessful lookup would return the `'?'` character. It now returns
`undefined` so that it is up to you how to handle the failure.

## Credits

Currency symbols originally sourced from [xe](http://www.xe.com/symbols.php), but maintained
and updated by [contributors](https://github.com/bengourley/currency-symbol-map/pulls?q=is%3Apr+is%3Aclosed).

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