A lightweight, zero-dependency currency formatter for React Native and Expo built with TypeScript. It supports 165+ ISO 4217 currency codes and provides correct symbol placement, thousands/decimal separators, and negative amount formatting. The library returns both symbol-prefixed and plain values as an array or object. Caching via an internal LRU cache (max 100 entries) ensures fast repeated calls. Unlike locale-based formatters, this uses pre-defined rules for each currency. Stable v1.0.0 — released with minimal breaking changes expected.
npm install react-native-format-currencyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of formatCurrency with array and object return types, and how to list supported currencies.
If locale-aware formatting is needed, consider using Intl.NumberFormat instead.
Use integers for cents (e.g., 123456 for $1,234.56) and multiply/divide accordingly before formatting.
Set returnType to 'object' if you prefer destructuring named properties.
Run 'npm install react-native-format-currency' (or yarn/pnpm) and ensure tsconfig.json includes 'node_modules' in moduleResolution.
Change 'import f from ...' to 'import { formatCurrency } from ...'Use formatCurrency({ amount: 1234.56, code: 'USD' })No dependency data recorded yet.