{"id":11527,"library":"parsecurrency","title":"Currency String Parser","description":"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.","status":"abandoned","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/mktj/parsecurrency","tags":["javascript","money","currency","format","utility","finance","parse","unformat"],"install":[{"cmd":"npm install parsecurrency","lang":"bash","label":"npm"},{"cmd":"yarn add parsecurrency","lang":"bash","label":"yarn"},{"cmd":"pnpm add parsecurrency","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import { parseCurrency } from 'parsecurrency';","symbol":"parseCurrency","correct":"const parseCurrency = require('parsecurrency');"}],"quickstart":{"code":"const parseCurrency = require('parsecurrency');\n\n// Example 1: Standard international format with symbol and ISO code\nconst result1 = parseCurrency('$123,456.99USD');\nconsole.log('Example 1:', result1);\n/*\nOutput:\n{\n  raw: '$123,456.99USD',\n  value: 123456.99,\n  integer: '123,456',\n  decimals: '.99',\n  currency: 'USD',\n  symbol: '$',\n  decimalSeparator: '.',\n  groupSeparator: ',',\n  sign: ''\n}\n*/\n\n// Example 2: Negative value with symbol prefix\nconst result2 = parseCurrency('-¥578,349,027');\nconsole.log('Example 2:', result2);\n/*\nOutput:\n{\n  raw: '-¥578,349,027',\n  value: -578349027,\n  integer: '-578,349,027',\n  decimals: '',\n  currency: '',\n  symbol: '¥',\n  decimalSeparator: '',\n  groupSeparator: ',',\n  sign: '-'\n}\n*/\n\n// Example 3: European format with space as group separator and comma as decimal\nconst result3 = parseCurrency('10 000,00zł');\nconsole.log('Example 3:', result3);\n/*\nOutput:\n{\n  raw: '10 000,00zł',\n  value: 10000,\n  integer: '10 000',\n  decimals: ',00',\n  currency: 'zł',\n  symbol: '',\n  decimalSeparator: ',',\n  groupSeparator: ' ',\n  sign: ''\n}\n*/","lang":"javascript","description":"Demonstrates parsing various currency string formats, including positive and negative values, with different symbols, group, and decimal separators, returning a structured object."},"warnings":[{"fix":"Consider alternative, actively maintained currency parsing libraries for production use, especially in environments requiring up-to-date security or feature support.","message":"The '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.","severity":"gotcha","affected_versions":">=1.1.1"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The utility cannot correctly parse currency strings that include three decimal places, which is a common format in some regions (e.g., Kuwaiti Dinar).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually preprocess such inputs to remove or replace the problematic separator before parsing, or use an alternative library with broader internationalization support.","message":"Currencies using a two-character group separator, such as the Swaziland Lilangeni, are not supported and will likely result in incorrect parsing or unexpected output.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Use the CommonJS `require` syntax for Node.js projects: `const parseCurrency = require('parsecurrency');`. For ESM, try `import parseCurrency from 'parsecurrency';`.","cause":"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.","error":"TypeError: parseCurrency is not a function"},{"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.","cause":"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.","error":"Unexpected parsing result for currency string"}],"ecosystem":"npm"}