https://github.com/dejurin/unformat-money-js
Tiny JavaScript library (532 bytes) by CurrencyRate.today, providing simple way removes all formatting/cruft and returns the raw float value.
https://github.com/dejurin/unformat-money-js
currency format money unformat
Last synced: 5 months ago
JSON representation
Tiny JavaScript library (532 bytes) by CurrencyRate.today, providing simple way removes all formatting/cruft and returns the raw float value.
- Host: GitHub
- URL: https://github.com/dejurin/unformat-money-js
- Owner: dejurin
- License: bsd-2-clause
- Created: 2020-11-01T13:53:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-17T22:43:21.000Z (over 1 year ago)
- Last Synced: 2025-10-11T16:29:16.658Z (9 months ago)
- Topics: currency, format, money, unformat
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/unformat-money-js
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# unformat-money-js
[](https://travis-ci.org/dejurin/unformat-money-js)
[](https://www.npmjs.com/package/unformat-money-js)

**Zero dependency** tiny JavaScript library (532 bytes) by CurrencyRate.today, providing simple way removes all formatting/cruft and returns the raw float value.
## Install
```bash
npm i unformat-money-js
```
## Usage
```typescript
import { UnFormatMoney } from 'unformat-money-js';
const unformat = new UnFormatMoney({ decimalPoint: '.' });
console.log(unformat.un('$12,345.67')); // 12345.67
```
## Options
You can added options in construct of class and in method. But method will be primary.
### Example:
```typescript
import { UnFormatMoney } from 'unformat-money-js';
const unformat = new UnFormatMoney({ decimalPoint: ',' });
console.log(unformat.un('€12.345,67', { decimalPoint: ',' })); // 12345.67
console.log(unformat.un('(12,345.67)', { decimalPoint: '.', accounting: true })); // -12345.67
```
| Name | Default | Type | Description |
|---------------|----------|---------|-------------|
| decimalPoint | . | String | Decimal point. |
| accounting | false | Boolean | If true, the parentheses are removed and a negative sign is added. |
## Source
https://currencyrate.today/
https://fx-w.io/