npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-format-currency

v1.0.0

Published

A lightweight international currency formatter for React Native & Expo (iOS and Android).

Downloads

9,366

Readme

react-native-format-currency

npm version npm downloads Follow @AwesomeLabsLLC on X

A 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.

  • Zero runtime deps (pure JS/TS)
  • 165+ currencies
  • Typed (TypeScript declarations included)
  • Fast (memoized with a small LRU cache)

Install

yarn add react-native-format-currency
npm install react-native-format-currency
pnpm add react-native-format-currency

Quick start

import { formatCurrency } from "react-native-format-currency";

const [withSymbol, withoutSymbol, symbol] = formatCurrency({
  amount: 1234.56,
  code: "USD",
});

// withSymbol: "$1,234.56"
// withoutSymbol: "1,234.56"
// symbol: "$"

API

formatCurrency({ amount, code, returnType? })

Formats a numeric amount for a given ISO 4217 currency code.

  • Params
    • amount: number: the numeric amount (negative supported)
    • code: string: ISO 4217 currency code (e.g. "USD", "EUR", "JPY")
    • returnType?: "array" | "object": optional return format (default: "array")
  • Returns
    • Array (default): [formattedWithSymbol, formattedWithoutSymbol, symbol]
    • Object: { formatted, value, symbol }
import { formatCurrency } from "react-native-format-currency";

// Array format (default)
formatCurrency({ amount: 1234.56, code: "ARS" });
// ["$ 1.234,56", "1.234,56", "$"]

formatCurrency({ amount: -99.99, code: "GBP" });
// ["-£99.99", "-99.99", "£"]

// Object format
formatCurrency({ amount: 1234.56, code: "USD", returnType: "object" });
// { formatted: "$1,234.56", value: "1,234.56", symbol: "$" }

Notes

  • Formatting is based on this package's internal currency rules (symbol, separators, symbol position, decimals). It does not take a locale argument.
  • For floating-point sensitive values, consider passing integers (e.g. cents) and dividing/rounding prior to formatting.

getSupportedCurrencies()

Returns all supported currencies as { code, name }[].

import { getSupportedCurrencies } from "react-native-format-currency";

const currencies = getSupportedCurrencies();
// [{ code: "AED", name: "United Arab Emirates Dirham" }, ...]

Cache helpers

formatCurrency memoizes results (LRU, max 100 entries) for speed.

import { clearFormatCache, getFormatCacheSize } from "react-native-format-currency";

console.log(getFormatCacheSize());
clearFormatCache();

Currency data and types

import type { CurrencyCode, CurrencyConfig, FormatResult, FormatResultObject, SupportedCurrency } from "react-native-format-currency";
import { CURRENCIES } from "react-native-format-currency";
  • CURRENCIES: full currency config map (symbols, separators, etc.)
  • CurrencyCode: union of supported ISO currency codes
  • FormatResult: array return type [string, string, string]
  • FormatResultObject: object return type { formatted, value, symbol }

Example app

The repo includes an Expo example in example/.

cd example
yarn install
yarn start

If 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).

Development

yarn install
yarn build
yarn test

Contributing

  • Please open an issue (or a PR) for bugs/feature requests.
  • Keep changes small and add/adjust tests where relevant.

Security

Please do not open public issues for security vulnerabilities. Prefer reporting privately via the project’s maintainer contact (see package.json / GitHub profile).

License

MIT — see LICENSE.