{"id":27787978,"url":"https://github.com/awesomelabs/react-native-format-currency","last_synced_at":"2026-03-15T21:14:13.252Z","repository":{"id":50493116,"uuid":"404470210","full_name":"AwesomeLabs/react-native-format-currency","owner":"AwesomeLabs","description":"A lightweight international currency formatter for React Native \u0026 Expo (iOS and Android).","archived":false,"fork":false,"pushed_at":"2025-01-29T16:19:01.000Z","size":343,"stargazers_count":33,"open_issues_count":3,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T16:52:59.759Z","etag":null,"topics":["currency","currency-format","expo","react-native"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AwesomeLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-08T19:26:15.000Z","updated_at":"2025-04-23T18:17:25.000Z","dependencies_parsed_at":"2024-01-26T10:05:14.345Z","dependency_job_id":"1b3aafd4-f85d-4a8f-983e-4a90d4da7e77","html_url":"https://github.com/AwesomeLabs/react-native-format-currency","commit_stats":{"total_commits":23,"total_committers":5,"mean_commits":4.6,"dds":"0.30434782608695654","last_synced_commit":"1b9ffb3c84a7f9dfefc641afad86806dc049e57c"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AwesomeLabs%2Freact-native-format-currency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AwesomeLabs%2Freact-native-format-currency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AwesomeLabs%2Freact-native-format-currency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AwesomeLabs%2Freact-native-format-currency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AwesomeLabs","download_url":"https://codeload.github.com/AwesomeLabs/react-native-format-currency/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251748924,"owners_count":21637412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["currency","currency-format","expo","react-native"],"created_at":"2025-04-30T16:53:07.640Z","updated_at":"2026-03-15T21:14:13.247Z","avatar_url":"https://github.com/AwesomeLabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- NOTE: Keep this README concise and copy/paste-friendly. --\u003e\n\n# react-native-format-currency\n\n[![npm version](https://img.shields.io/npm/v/react-native-format-currency.svg)](https://www.npmjs.com/package/react-native-format-currency)\n[![npm downloads](https://img.shields.io/npm/dm/react-native-format-currency.svg)](https://www.npmjs.com/package/react-native-format-currency)\n[![Follow @AwesomeLabsLLC on X](https://img.shields.io/badge/follow-%40AwesomeLabsLLC-00b4d8?logo=x\u0026logoColor=white)](https://x.com/AwesomeLabsLLC)\n\nA lightweight currency formatter for **React Native** and **Expo**. Format amounts using ISO 4217 currency codes with correct symbol placement and common thousands/decimal separator styles.\n\n- **Zero runtime deps** (pure JS/TS)\n- **165+ currencies**\n- **Typed** (TypeScript declarations included)\n- **Fast** (memoized with a small LRU cache)\n\n## Install\n\n```sh\nyarn add react-native-format-currency\n```\n\n```sh\nnpm install react-native-format-currency\n```\n\n```sh\npnpm add react-native-format-currency\n```\n\n## Quick start\n\n```ts\nimport { formatCurrency } from \"react-native-format-currency\";\n\nconst [withSymbol, withoutSymbol, symbol] = formatCurrency({\n  amount: 1234.56,\n  code: \"USD\",\n});\n\n// withSymbol: \"$1,234.56\"\n// withoutSymbol: \"1,234.56\"\n// symbol: \"$\"\n```\n\n## API\n\n### `formatCurrency({ amount, code, returnType? })`\n\nFormats a numeric amount for a given ISO 4217 currency code.\n\n- **Params**\n  - `amount: number`: the numeric amount (negative supported)\n  - `code: string`: ISO 4217 currency code (e.g. `\"USD\"`, `\"EUR\"`, `\"JPY\"`)\n  - `returnType?: \"array\" | \"object\"`: optional return format (default: `\"array\"`)\n- **Returns**\n  - Array (default): `[formattedWithSymbol, formattedWithoutSymbol, symbol]`\n  - Object: `{ formatted, value, symbol }`\n\n```ts\nimport { formatCurrency } from \"react-native-format-currency\";\n\n// Array format (default)\nformatCurrency({ amount: 1234.56, code: \"ARS\" });\n// [\"$ 1.234,56\", \"1.234,56\", \"$\"]\n\nformatCurrency({ amount: -99.99, code: \"GBP\" });\n// [\"-£99.99\", \"-99.99\", \"£\"]\n\n// Object format\nformatCurrency({ amount: 1234.56, code: \"USD\", returnType: \"object\" });\n// { formatted: \"$1,234.56\", value: \"1,234.56\", symbol: \"$\" }\n```\n\n**Notes**\n- Formatting is based on this package's internal currency rules (symbol, separators, symbol position, decimals). It does **not** take a locale argument.\n- For floating-point sensitive values, consider passing integers (e.g. cents) and dividing/rounding prior to formatting.\n\n### `getSupportedCurrencies()`\n\nReturns all supported currencies as `{ code, name }[]`.\n\n```ts\nimport { getSupportedCurrencies } from \"react-native-format-currency\";\n\nconst currencies = getSupportedCurrencies();\n// [{ code: \"AED\", name: \"United Arab Emirates Dirham\" }, ...]\n```\n\n### Cache helpers\n\n`formatCurrency` memoizes results (LRU, max 100 entries) for speed.\n\n```ts\nimport { clearFormatCache, getFormatCacheSize } from \"react-native-format-currency\";\n\nconsole.log(getFormatCacheSize());\nclearFormatCache();\n```\n\n### Currency data and types\n\n```ts\nimport type { CurrencyCode, CurrencyConfig, FormatResult, FormatResultObject, SupportedCurrency } from \"react-native-format-currency\";\nimport { CURRENCIES } from \"react-native-format-currency\";\n```\n\n- `CURRENCIES`: full currency config map (symbols, separators, etc.)\n- `CurrencyCode`: union of supported ISO currency codes\n- `FormatResult`: array return type `[string, string, string]`\n- `FormatResultObject`: object return type `{ formatted, value, symbol }`\n\n## Example app\n\nThe repo includes an Expo example in [`example/`](example/).\n\n```sh\ncd example\nyarn install\nyarn start\n```\n\nIf Expo complains about your Node version, use an LTS-compatible Node version required by the Expo SDK you’re running (see Expo’s docs for the current requirement).\n\n## Development\n\n```sh\nyarn install\nyarn build\nyarn test\n```\n\n## Contributing\n\n- Please open an issue (or a PR) for bugs/feature requests.\n- Keep changes small and add/adjust tests where relevant.\n\n## Security\n\nPlease **do not** open public issues for security vulnerabilities. Prefer reporting privately via the project’s maintainer contact (see `package.json` / GitHub profile).\n\n## License\n\nMIT — see [`LICENSE`](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawesomelabs%2Freact-native-format-currency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawesomelabs%2Freact-native-format-currency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawesomelabs%2Freact-native-format-currency/lists"}