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

flags-lib

v0.1.5

Published

Typed currency and country metadata with flag asset references.

Downloads

449

Readme

flags-lib

Typed metadata for currencies and countries that links to flag assets. Drop this package into any TypeScript/JavaScript project to keep a single source of truth for currency names, symbols, ISO codes, and associated countries.


📉 Project Layout

  • src/types.ts – shared TypeScript interfaces (CurrencyMeta, Country, etc.)
  • src/data/currencies.ts – curated list of currencies with PNG flag pointers
  • src/data/countries.ts – list of countries with SVG flag pointers
  • assets/images/curr-flags/ – expected location for currency PNGs
  • assets/images/country-flags/ – expected location for country SVGs

Only a sample of data is included for structure validation. You can replace or extend it with your own datasets or generate from JSON.


⚙️ Development

npm install
npm run build

npm run build compiles the TypeScript sources into dist/ and emits type declarations.


🚀 Usage

import {
  currencies,
  countries,
  getCurrencyByCode,
  getCountriesUsingCurrency,
} from "flags-lib";

const usd = getCurrencyByCode("USD");
const audCountries = getCountriesUsingCurrency("AUD");

Because flag image paths are relative, you can use them with any bundler or static setup (e.g. Vite, Angular, Webpack, etc.). If needed, override the asset paths in your own build system.


🎨 Using Flag Styles in UI

If you include the provided CSS files in your project, you can render flags via utility classes:

<span class="fl fl-xxx"></span> <span class="fl fl-xxx fls"></span>
  • fl is the base styling class (sets dimensions and layout)
  • fl-xxx is the lowercase ISO code (e.g. usd, eur, tr)
  • fls is optional, and makes the flag icon square instead of rectangular

Example:

<span class="fl fl-usd"></span>

<span class="fl fl-gr"></span>
<!-- Greece country flag -->
<span class="fl fl-gr fls"></span>
<!-- Square Greece flag -->

Import the CSS files:

@import "/node-modules/flags-lib/css/currency-flag-libs.css";
@import "/node-modules/flags-lib/css/country-flag-libs.css";

✅ Make sure the assets in flags-lib/assets/ are available in your final app build. For Angular, configure "assets" in angular.json to copy these files into your app’s /assets directory.


🔧 Extending the Dataset

  1. Add or replace entries in src/data/currencies.ts and src/data/countries.ts
  2. Drop the corresponding SVG/PNG assets into assets/images
  3. Run npm run build to emit the updated package

You can also automate this using your own JSON source and generate TypeScript output during build time.


📄 License

MIT — Ozge Topcu