# parse-formatted-number

> Parses a formatted number from a string and returns a number.

Latest version **1.1.1** (published 2021-05-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse-formatted-number
pnpm add parse-formatted-number
yarn add parse-formatted-number
bun add parse-formatted-number
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-05-09 |
| First published | 2018-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jacob Buck |
| Maintainers | jacobbuck |
| Keywords | currency, float, formatted, int, money, number, parse, parser, string |

## Links

- npm: https://www.npmjs.com/package/parse-formatted-number
- Repository: https://github.com/jacobbuck/parse-formatted-number
- Homepage: https://github.com/jacobbuck/parse-formatted-number#readme
- Issues: https://github.com/jacobbuck/parse-formatted-number/issues
- npm.io page: https://npm.io/package/parse-formatted-number

## Dependencies (1)

- [tiny-invariant](https://npm.io/package/tiny-invariant.md) ^1.1.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-05-09
- 1.1.0 — 2020-11-14
- 1.0.4 — 2020-04-27
- 1.0.3 — 2019-06-02
- 1.0.2 — 2018-10-21
- 1.0.1 — 2018-03-06
- 1.0.0 — 2018-03-05

## README

# parse-formatted-number

Parses a formatted number from a string and returns a number.

## Usage

```js
parseFormattedNumber(value[, options])
```

### Parameters

- `value` The value you want to parse.
- `options` optional object of the following options:
  - `decimal` string decimal separator character, defaults to `"."`.

### Return value

`Number` number parsed from the given value. If the value cannot be converted to a number, `NaN` is returned.

## Example

```js
import parseFormattedNumber from 'parse-formatted-number';

parseFormattedNumber('NZD $12,345.60');
// returns 12345.6

parseFormattedNumber('123,45', { decimal: ',' });
// returns 123.45
```

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