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

kilfx

v4.0.3

Published

UI-only currency pair widget with flag dropdowns + search for CDN, Node/Express, and React/Next.js.

Readme

kilfx

UI-only currency pair selector (flags + search) for:

  • CDN <script> (single JS file with auto CSS injection)
  • Node/Express pages
  • Next.js / React (npm install kilfx)

kilfx does not fetch FX rates or call external FX APIs.
It only handles UI + emits change events so your app can fetch rates manually.

Install

npm install kilfx

DOM Convention

<div class="kilfx" kilfx_int="JMD" kilfx_only="JMD,USD,GBP">
  <select name="kilfx_base"></select>
  <select name="kilfx_to"></select>
  <input type="text" name="fx_rate" readonly />
</div>

Required in same .kilfx block:

  • select[name="kilfx_base"]
  • select[name="kilfx_to"]

Optional:

  • input[name="fx_rate"] (forced readonly and cleared on pair change)

Also supported for Bootstrap-style split layout (different .kilfx columns):

  • base_currency (alias of base)
  • display_currency (alias of to)
  • exchange_rate (alias of rate)

CDN Usage

<script src="https://yourcdn.com/kilfx.iife.min.js"></script>

That alone auto-inits .kilfx blocks on page load.

If you want custom config, add:

<script src="https://yourcdn.com/kilfx.iife.min.js"></script>
<script>
  KILFX.init({
    flagsPath: "/svg",
    defaultBase: "JMD",
    defaultTo: "USD"
  });
</script>

Optional explicit helper:

<script>
  KILFX.autoInit({ flagsPath: "/svg" });
</script>

npm / ESM Usage

import { init } from "kilfx";
init({ flagsPath: "/svg" });

Optional CSS import (JS still injects CSS automatically):

import "kilfx/dist/kilfx.css";

React / Next Usage

"use client";
import { KilFx } from "kilfx/react";

export default function Page() {
  return <KilFx flagsPath="/svg" defaultBase="JMD" defaultTo="USD" />;
}

Or render your own .kilfx markup and call init() in useEffect.

Events

On every base/to change, kilfx:

  1. Updates hidden native <select> value
  2. Dispatches native change on that <select>
  3. Dispatches global event:
document.addEventListener("kilfx:change", (e) => {
  const { base, to, rootEl, baseSelectEl, toSelectEl, rateInputEl, baseItem, toItem } = e.detail;
});

detail shape:

  • base / to: currency code ("USD", "JMD", etc.)
  • rootEl: current .kilfx container
  • baseSelectEl, toSelectEl: underlying native selects
  • rateInputEl: resolved rate input in same form/group
  • baseItem, toItem: { code, name, flag_code }

API

init({
  rootSelector: ".kilfx",
  baseName: "kilfx_base",
  toName: "kilfx_to",
  rateName: "fx_rate",
  flagsPath: "/svg",
  fileCase: "auto",       // auto | upper | lower
  enableSearch: true,
  defaultBase: "JMD",
  defaultTo: "JMD",
  initCurrency: "JMD",    // fallback for both (kilfx_int also works)
  only: "JMD,USD,GBP",    // restrict both dropdowns by currency code
  onlyBase: "JMD,USD",    // optional base-only restriction
  onlyTo: "USD,EUR",      // optional to-only restriction
  data: null              // custom currency data or null for built-in
});

Attribute Shortcuts (Per .kilfx)

Container attributes:

  • kilfx_int="JMD": default code for both dropdowns (if specific defaults not set)
  • kilfx_only="JMD,USD,GBP": restrict both dropdowns to selected currency codes
  • kilfx_base_int="USD" / kilfx_to_int="JMD": specific defaults
  • kilfx_base_only="USD,CAD" / kilfx_to_only="JMD,EUR": specific allowed lists

Select-level overrides also supported:

  • select ... kilfx_int="USD"
  • select ... kilfx_only="USD,JMD"

If nothing is provided, both dropdowns default to JMD.

Acceptance Example

<div class="kilfx">
  <select name="kilfx_base"></select>
  <select name="kilfx_to"></select>
  <input name="fx_rate" readonly />
</div>

<script src="/dist/kilfx.iife.min.js"></script>
<script>
  KILFX.init({ flagsPath: "/svg", defaultBase: "JMD", defaultTo: "USD" });

  document.addEventListener("kilfx:change", async (e) => {
    const { base, to, rateInputEl } = e.detail;
    const rateInput = rateInputEl;
    rateInput.value = "...";
    // const { data } = await axios.get("/api/fx/rate", { params: { base, to } });
    // rateInput.value = data.rate;
  });
</script>