1.5.0 • Published 10 months ago

currency-to-float v1.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

CurrencyToFloat

CI code coverage 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

import currencyToFloat from 'currency-to-float';
// Or use CommonJs:
// const { parse } = require('currency-to-float');

const value = currencyToFloat('$12.50 USD');

console.log(value); // 12.5

Supported Currencies

CurrencyLocaleInput (string)Output (Number)
US Dollar ($, USD)en-US$12.50 USD12.5
Brazilian Real (R$, BRL)pt-BRR$ 12,5012.5
Canadian Dollar ($, CAD)en-CA$12.50 CAD12.5
Canadian Dollar ($, CAD)fr-CA12,50 $ CAD12.5
Australian Dollar ($, AUD)en-AU$12.50 AUD12.5
Euro (€, EUR)de-DE, fr-FR12,50 € EUR12.5
Euro (€, EUR)en-IE€12.50 EUR12.5
Euro (€, EUR)nl-NL€12,50 EUR12.5
British Pounds (£, GBP)en-GB£12.50 GBP12.5
Japanese Yen (¥, JPY)ja-JP¥1250 JPY1250
New Zealand Dollar ($, NZD)en-NZ$12.50 NZD12.5
Hong Kong Dollar ($, HKD)zh-HK$12.50 HKD12.5
Singapore Dollar ($, SGD)zh-SG$12.50 SGD12.5
Danish Krone (Kr, DKK)da-DK12,50 kr. DKK12.5

Benchmark

Run locally with npm run benchmark

currencyToFloat x 235,939 ops/sec ±1.10% (92 runs sampled)
currency.js x 204,132 ops/sec ±2.87% (89 runs sampled)
Fastest is currencyToFloat

License

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

1.5.0

10 months ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.3.1

3 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago