currency-to-float
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

CurrencyToFloat

CI codecov bundle size

The currency-to-float package is a dependency-free utility designed to convert currency values into numerical representations without the need to specify the source currency.

Installation

You can install currency-to-float using npm or any other package manager:

npm install currency-to-float

Usage

// ESM
import currencyToFloat from 'currency-to-float';

// CommonJs
const { parse } = require('currency-to-float');

const value = currencyToFloat('R$ 1.000,00');

console.log(value); // 1000

Supported Currencies

Currency Locale Input (string) Output (Number)
US Dollar ($, USD) en-US $12.50 USD 12.5
US Dollar ($, USD) en-US $12 USD 12
Brasilian Real (R$, BRL) pt-BR R$ 12,50 12.5
Canadian Dollar ($, CAD) en-CA $12.50 CAD 12.5
Canadian Dollar ($, CAD) fr-CA 12,50 $ CAD 12.5
Australian Dollar ($, AUD) en-AU $12.50 AUD 12.5
Euro (€, EUR) de-DE, fr-FR 12,50 € EUR 12.5
Euro (€, EUR) en-IE €12.50 EUR 12.5
Euro (€, EUR) nl-NL €12,50 EUR 12.5
British Pounds (£, GBP) en-GB £12.50 GBP 12.5
Japanese Yen (¥, JPY) ja-JP ¥1250 JPY 1250
New Zealand Dollar ($, NZD) en-NZ $12.50 NZD 12.5
Hong Kong Dollar ($, HKD) zh-HK $12.50 HKD 12.5
Singapore Dollar ($, SGD) zh-SG $12.50 SGD 12.5
Danish Krone (Kr, DKK) da-DK 12,50 kr. DKK 12.5

License

This package is open-source and available under the MIT License.

Package Sidebar

Install

npm i currency-to-float

Weekly Downloads

14

Version

1.4.1

License

MIT

Unpacked Size

10.4 kB

Total Files

9

Last publish

Collaborators

  • mateus4k