Registry / serialization / parsecurrency

parsecurrency

JSON →
library1.1.1jsnpmunverified

The `parsecurrency` package provides a minimalist utility for parsing currency strings, extracting components such as the numerical value, currency symbol, decimal and group separators, and ISO code. Currently at version 1.1.1, the package was last updated over six years ago and appears to be abandoned, with no active development or maintenance. While it supports many common international currency formats, including Indian numbering, it has explicit limitations, notably an inability to process currencies with three decimal places or two-character group separators. Due to its age, it primarily supports CommonJS imports, and users should be aware of potential compatibility issues in modern ESM-only environments and the lack of ongoing security patches or feature enhancements.

npm install parsecurrency
INSTALL
IMPORT
SIG · PARSECURRENCY
P
parsecurrency
serializationjavascriptv1.1.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parseCurrency
✓ const parseCurrency = require('parsecurrency');
✗ import { parseCurrency } from 'parsecurrency';
This package is CommonJS-only and exports a single function. Use `require()` for Node.js. For ESM, try `import parseCurrency from 'parsecurrency'` but be aware of potential compatibility issues.

Demonstrates parsing various currency string formats, including positive and negative values, with different symbols, group, and decimal separators, returning a structured object.

const parseCurrency = require('parsecurrency'); // Example 1: Standard international format with symbol and ISO code const result1 = parseCurrency('$123,456.99USD'); console.log('Example 1:', result1); /* Output: { raw: '$123,456.99USD', value: 123456.99, integer: '123,456', decimals: '.99', currency: 'USD', symbol: '$', decimalSeparator: '.', groupSeparator: ',', sign: '' } */ // Example 2: Negative value with symbol prefix const result2 = parseCurrency('-¥578,349,027'); console.log('Example 2:', result2); /* Output: { raw: '-¥578,349,027', value: -578349027, integer: '-578,349,027', decimals: '', currency: '', symbol: '¥', decimalSeparator: '', groupSeparator: ',', sign: '-' } */ // Example 3: European format with space as group separator and comma as decimal const result3 = parseCurrency('10 000,00zł'); console.log('Example 3:', result3); /* Output: { raw: '10 000,00zł', value: 10000, integer: '10 000', decimals: ',00', currency: 'zł', symbol: '', decimalSeparator: ',', groupSeparator: ' ', sign: '' } */
Debug
Known issues
gotchaThe 'parsecurrency' package has not been updated in over six years and appears to be abandoned. Users should be cautious about using it in new projects, as it may not receive security updates, bug fixes, or compatibility improvements for newer Node.js versions or JavaScript features.
fix
Consider alternative, actively maintained currency parsing libraries for production use, especially in environments requiring up-to-date security or feature support.
affects: >=1.1.1
gotchaThis package primarily supports CommonJS modules (`require()`). While it might be possible to import it into an ESM project using compatibility layers, direct native ESM support is not provided, which can lead to import issues or bundle size inefficiencies.
fix
For ESM projects, use `import parseCurrency from 'parsecurrency'` and ensure your build tools (e.g., Webpack, Rollup) are configured to handle CommonJS modules. Alternatively, seek an ESM-native parsing library.
affects: >=1.0.0
gotchaThe utility cannot correctly parse currency strings that include three decimal places, which is a common format in some regions (e.g., Kuwaiti Dinar).
fix
Manually preprocess inputs with three decimals (e.g., truncate or round) before passing them to `parsecurrency`, or use a different library that explicitly supports this format.
affects: >=1.0.0
gotchaCurrencies using a two-character group separator, such as the Swaziland Lilangeni, are not supported and will likely result in incorrect parsing or unexpected output.
fix
Manually preprocess such inputs to remove or replace the problematic separator before parsing, or use an alternative library with broader internationalization support.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: parseCurrency is not a function
Attempting to use a named import syntax (e.g., `import { parseCurrency } from 'parsecurrency';`) with this CommonJS package, which exports a single function or default value.
fix
Use the CommonJS `require` syntax for Node.js projects: `const parseCurrency = require('parsecurrency');`. For ESM, try `import parseCurrency from 'parsecurrency';`.
Unexpected parsing result for currency string
Input string contains a currency format (e.g., three decimal places, two-character group separator, or an uncommon locale) that the library does not explicitly support or handle correctly.
fix
Review the library's limitations and compare them with your input format. For unsupported formats, consider preprocessing the input, using a more robust internationalization library, or implementing custom parsing logic.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
parsecurrency — npm install parsecurrency · libregistry