Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parsecurrency

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsecurrency

Currency string parser utility

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.4K
decreased by-10.98%
Maintainers
1
Weekly downloads
 
Created
Source

parsecurrency

Build Status

Node / browser currency parser.

Extensive currency parsing utility designed to extract value, decimal separator, group separator, currency symbol and iso code from currency string. It should work with most world currency formats except:

  • currencies with 3 decimals
  • currency with 2 character group separator (Swaziland Lilangeni)

Works with:

  • international currency formatting (SFr 12'345.67 or 10 000,00zł)
  • indian number system (₹1,50,000.00)
  • currency symbols as a prefix / suffix with or without a space
  • currency code before or after the value, with or without space

Install

npm i parsecurrency --save

Example

const parseCurrency = require('parsecurrency');

const parsedCurrency = parseCurrency('$123,456.99USD');
// parsedCurrency =>
{
  "raw": "$123,456.99USD",
  "value": 123456.99,
  "integer": "123,456",
  "decimals": ".99",
  "currency": "USD",
  "symbol": "$",
  "decimalSeparator": ".",
  "groupSeparator": ","
}

More examples

Keywords

FAQs

Package last updated on 15 Dec 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc