https://github.com/caiogondim/parse-price.js
:dollar: Returns a Number from a localized price string.
https://github.com/caiogondim/parse-price.js
Last synced: about 1 month ago
JSON representation
:dollar: Returns a Number from a localized price string.
- Host: GitHub
- URL: https://github.com/caiogondim/parse-price.js
- Owner: caiogondim
- License: mit
- Created: 2016-08-01T16:08:03.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-28T18:12:17.000Z (about 7 years ago)
- Last Synced: 2025-03-24T21:51:09.375Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://npm.im/parse-price
- Size: 159 KB
- Stars: 21
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# parse-price
[](https://codecov.io/gh/caiogondim/parse-price.js)
![]()
Returns a `Number` from a localized price string.
## Installation
```shell
npm install --save parse-price
```## Usage
Receives a string (price) as input and returns a `Number` (or `NaN`) as output.
```js
var parsePrice = require('parse-price')parsePrice('€1.234,56') // => 1234.56
parsePrice('US$ 1.234,56') // => 1234.56
parsePrice('£1,234.56') // => 1234.56
parsePrice('R$1.234,56') // => 1234.56
parsePrice('1 234,56 руб') // => 1234.56
parsePrice('1,234.56 ₪') // => 1234.56
```---
[caiogondim.com](https://caiogondim.com) ·
GitHub [@caiogondim](https://github.com/caiogondim) ·
Twitter [@caio_gondim](https://twitter.com/caio_gondim)