{"id":41145,"library":"geld","title":"geld","description":"geld is a minimal currency formatter for Node.js (>=22) and browsers, providing a simple function to format numbers as currency strings. It offers options for currency symbol, decimal and group separators, position of currency symbol, and a special zero-decimals placeholder. The package is ESM-only (CJS requires dynamic import) and ships TypeScript type definitions. Version 4.0.0 is the latest stable release. Its key differentiator is extreme minimalism and opinionated German defaults (Euro, comma decimal, dot thousands, no-break space).","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mrcgrtz/geld","tags":["javascript","currency","format","typescript"],"install":[{"cmd":"npm install geld","lang":"bash","label":"npm"},{"cmd":"yarn add geld","lang":"bash","label":"yarn"},{"cmd":"pnpm add geld","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; use dynamic import if in a CommonJS context: import('geld').then(m => m.default).","wrong":"const geld = require('geld')","symbol":"default","correct":"import geld from 'geld'"},{"note":"Type-only import for the options interface; not exported as a value.","symbol":"geld type (TypeScript)","correct":"import type { GeldOptions } from 'geld'"},{"note":"The options type is exported only as a type; use `import type` to avoid runtime errors.","symbol":"GeldOptions","correct":"import type { GeldOptions } from 'geld'"}],"quickstart":{"code":"import geld from 'geld';\n\nconst price1 = geld(42.23);\nconsole.log(price1); // => '42,23 €'\n\nconst price2 = geld(42, { zeroDecimals: '–' });\nconsole.log(price2); // => '42,– €'\n\nconst price3 = geld('1234.56', {\n  currency: '$',\n  currencyPosition: 'before',\n  decimalSeparator: '.',\n  orderSeparator: ',',\n  decimals: 2,\n  space: ' '\n});\nconsole.log(price3); // => '$ 1,234.56'","lang":"typescript","description":"Demonstrates basic usage with default German Euro formatter and custom options with US dollar formatting."},"warnings":[{"fix":"Upgrade to Node.js 22 or later, or stay on geld v3.x if you need older Node.","message":"Version 4.0.0 drops support for Node.js <22. Older Node.js versions will error at import.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use dynamic import: `const geld = await import('geld');` or set `\"type\": \"module\"` in package.json.","message":"Versions 4.0.0 is ESM-only; CJS require() throws ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Explicitly set `{ decimalSeparator: '.' }` if you need a period decimal.","message":"The default decimal separator is comma (','), not period ('.'), which may cause confusion for US users.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Override with `{ space: ' ' }` if you want a regular space.","message":"The default space between value and currency is a non-breaking space (U+00A0), not a regular space.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"No deprecation planned; it is stable. Document clearly for international teams.","message":"The option `orderSeparator` is named after 'order' (German for 'thousands'); this is not intuitive in English.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'22':10 '4.0.0':60 'break':83 'browser':12 'cjs':50 'comma':77 'currenc':6,21,27,35,86 'decim':29,42,78 'default':75 'definit':58 'differenti':68 'dot':79 'dynam':52 'esm':48 'esm-on':47 'euro':76 'extrem':70 'format':18,87 'formatt':7 'function':16 'geld':1,2 'german':74 'group':31 'import':53 'javascript':85 'key':67 'latest':63 'minim':5,71 'no-break':81 'node.js':9 'number':19 'offer':24 'opinion':73 'option':25 'packag':45 'placehold':43 'posit':33 'provid':13 'releas':65 'requir':51 'separ':32 'ship':55 'simpl':15 'space':84 'special':39 'stabl':64 'string':22 'symbol':28,36 'thousand':80 'type':57 'typescript':56,88 'version':59 'zero':41 'zero-decim':40","created_at":"2026-06-04T18:50:59.672201+00:00","updated_at":"2026-06-04T18:50:59.672201+00:00","problems":[{"fix":"Use dynamic import: `const geld = await import('geld');` or convert your project to ESM.","cause":"Attempting to require() an ESM-only package (v4) in a CommonJS module.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/geld/index.js from /path/to/project/index.js not supported."},{"fix":"Use `const geld = require('geld').default;` or use dynamic import.","cause":"Using a default import after a CJS require() that returns an object with a default property.","error":"TypeError: geld is not a function"},{"fix":"Upgrade Node.js to ^22.0.0 or use geld v3 (which may support CJS).","cause":"Node.js version <22 does not support ESM syntax used in geld v4.","error":"SyntaxError: Unexpected token 'export' (or similar) in older Node"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mrcgrtz/geld#readme","github":"https://github.com/mrcgrtz/geld","docs":null,"changelog":null,"pypi":null,"npm":"geld","openapi_spec":null,"status_page":null,"smithery":null,"categories":["payments"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}