Socket
Book a DemoInstallSign in
Socket

currency-to-float

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

currency-to-float

Parse any currency

1.5.0
latest
Source
npmnpm
Version published
Weekly downloads
16
60%
Maintainers
0
Weekly downloads
 
Created
Source

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.

Keywords

currency

FAQs

Package last updated on 27 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.