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

checkdigitkit

v0.1.0

Published

Zero-dependency TypeScript check digit algorithms: Luhn (credit cards, IMEI), IBAN/BBAN validation, ISBN-10/13, Damm, Verhoeff. Fills gap left by abandoned 'luhn' (72k/week) and 'iban' (207k/week) packages.

Readme

checkdigitkit

All Contributors

Zero-dependency TypeScript check digit algorithms: Luhn (credit cards, IMEI), IBAN/BBAN validation & formatting, ISBN-10/13, Damm, credit card type detection. Fills the gaps left by abandoned luhn (72k/week) and iban (207k/week) npm packages.

npm license zero dependencies

Install

npm install checkdigitkit

Why?

  • luhn npm package — 72k downloads/week — abandoned since 2022, no TypeScript types
  • iban npm package — 207k downloads/week — abandoned since 2022, no TypeScript types
  • checkdigitkit covers both plus ISBN-10/13, Damm, IMEI, and credit card type detection — all in one zero-dep package

Quick start

import { luhnIsValid, ibanIsValid, creditCardValidate } from "checkdigitkit";

// Credit card validation
luhnIsValid("4532015112830366"); // true (valid Visa)
luhnIsValid("4532015112830367"); // false (bad check digit)

// Bank account validation
ibanIsValid("GB29NWBK60161331926819"); // true
ibanIsValid("GB29 NWBK 6016 1331 9268 19"); // true (spaces OK)

// Full card info
const info = creditCardValidate("5425233430109903");
// { type: "mastercard", isValid: true, digits: "5425233430109903" }

API

Luhn algorithm

Used to validate credit card numbers, IMEI numbers, NPI numbers.

import { luhnIsValid, luhnCheckDigit, luhnComplete } from "checkdigitkit";

// Validate
luhnIsValid("4532015112830366"); // true
luhnIsValid("4532 0151 1283 0366"); // true (spaces stripped)

// Generate check digit for a partial number
luhnCheckDigit("453201511283036"); // 6

// Append check digit
luhnComplete("453201511283036"); // "4532015112830366"

IBAN validation

International Bank Account Number (ISO 13616-1). Supports 70+ countries.

import {
  ibanIsValid, ibanFormat, ibanNormalize,
  ibanCountry, ibanBban, ibanCountrySupported, ibanExpectedLength
} from "checkdigitkit";

// Validate (case-insensitive, spaces stripped automatically)
ibanIsValid("DE89370400440532013000"); // true
ibanIsValid("gb29 nwbk 6016 1331 9268 19"); // true

// Format for display
ibanFormat("GB29NWBK60161331926819");
// → "GB29 NWBK 6016 1331 9268 19"

// Extract parts
ibanCountry("GB29NWBK60161331926819"); // "GB"
ibanBban("GB29NWBK60161331926819");    // "NWBK60161331926819"

// Country info
ibanCountrySupported("DE"); // true
ibanExpectedLength("DE");   // 22
ibanExpectedLength("NO");   // 15  (shortest: Norway)
ibanExpectedLength("MT");   // 31  (longest: Malta)

ISBN validation

import { isbn10IsValid, isbn13IsValid, isbnIsValid, isbn10To13 } from "checkdigitkit";

// ISBN-10 (dashes and spaces stripped automatically)
isbn10IsValid("0-306-40615-2"); // true
isbn10IsValid("080442957X");    // true (X = 10)

// ISBN-13
isbn13IsValid("978-0-306-40615-7"); // true
isbn13IsValid("9783161484100");     // true

// Auto-detect by length
isbnIsValid("0306406152");   // true (ISBN-10, 10 chars)
isbnIsValid("9780306406157"); // true (ISBN-13, 13 chars)

// Convert ISBN-10 to ISBN-13
isbn10To13("0306406152"); // "9780306406157"
isbn10To13("080442957X"); // "9780804429573"

Damm algorithm

Detects all single-digit errors and adjacent transpositions.

import { dammIsValid, dammCheckDigit, dammComplete } from "checkdigitkit";

dammCheckDigit("572"); // 4
dammComplete("572");   // "5724"
dammIsValid("5724");   // true
dammIsValid("5714");   // false (single digit error detected)
dammIsValid("7524");   // false (adjacent transposition detected)

IMEI validation

15-digit mobile device identifier (Luhn check).

import { imeiIsValid } from "checkdigitkit";

imeiIsValid("490154203237518"); // true
imeiIsValid("490154203237519"); // false (bad check digit)
imeiIsValid("49015420323751");  // false (too short)

Credit card validation and type detection

import { creditCardIsValid, creditCardType, creditCardValidate } from "checkdigitkit";

// Quick boolean check
creditCardIsValid("4532015112830366");  // true (Visa)
creditCardIsValid("4532015112830366".replace("6", "7")); // false

// Type detection (by BIN prefix)
creditCardType("4532015112830366");   // "visa"
creditCardType("5425233430109903");   // "mastercard"
creditCardType("378282246310005");    // "amex"
creditCardType("6011111111111117");   // "discover"

// Full info
creditCardValidate("5425233430109903");
// { type: "mastercard", isValid: true, digits: "5425233430109903" }

// Accepts spaces and dashes
creditCardIsValid("4532 0151 1283 0366"); // true
creditCardIsValid("4532-0151-1283-0366"); // true

Use cases

Payment form validation

import { creditCardValidate, luhnIsValid } from "checkdigitkit";

function validatePaymentForm(card: string, cvv: string) {
  const { type, isValid } = creditCardValidate(card);
  if (!isValid) return { error: "Invalid card number" };

  const cvvLength = type === "amex" ? 4 : 3;
  if (!/^\d+$/.test(cvv) || cvv.length !== cvvLength) {
    return { error: `CVV must be ${cvvLength} digits for ${type}` };
  }

  return { type, ok: true };
}

validatePaymentForm("4532015112830366", "123"); // { type: "visa", ok: true }

SEPA transfer validation

import { ibanIsValid, ibanFormat } from "checkdigitkit";

function processSEPATransfer(rawIban: string, amount: number) {
  if (!ibanIsValid(rawIban)) {
    throw new Error(`Invalid IBAN: ${rawIban}`);
  }
  const displayIban = ibanFormat(rawIban);
  return { iban: displayIban, amount, status: "queued" };
}

processSEPATransfer("DE89370400440532013000", 1000);
// { iban: "DE89 3704 0044 0532 0130 00", amount: 1000, status: "queued" }

Book catalog import with ISBN validation

import { isbnIsValid, isbn10To13 } from "checkdigitkit";

function normalizeBook(isbn: string, title: string) {
  if (!isbnIsValid(isbn)) throw new Error(`Invalid ISBN: ${isbn}`);
  const clean = isbn.replace(/[-\s]/g, "").toUpperCase();
  const isbn13 = clean.length === 10 ? isbn10To13(clean) : clean;
  return { isbn13, title };
}

Device inventory IMEI validation

import { imeiIsValid } from "checkdigitkit";

function registerDevice(imei: string, model: string) {
  if (!imeiIsValid(imei)) throw new Error(`Invalid IMEI: ${imei}`);
  return { imei, model, registeredAt: new Date() };
}

Supported algorithms

| Algorithm | Standard | Use case | |---|---|---| | Luhn | ISO/IEC 7812-1 | Credit cards, IMEI, NPI, Canadian SIN | | IBAN mod-97 | ISO 13616-1 | Bank account numbers (70+ countries) | | ISBN-10 | ISO 2108 | 10-digit book identifiers (pre-2007) | | ISBN-13 / EAN-13 | ISO 2108 | 13-digit book and product identifiers | | Damm | Damm 2004 | Catches all single-digit errors and adjacent transpositions |

Supported IBAN countries (70+)

AD, AE, AL, AT, AZ, BA, BE, BF, BG, BH, BI, BJ, BR, BY, CF, CG, CH, CI, CM, CR, CV, CY, CZ, DE, DJ, DK, DO, DZ, EE, EG, ES, FI, FK, FO, FR, GA, GB, GE, GI, GL, GQ, GR, GT, GW, HN, HR, HU, IE, IL, IQ, IR, IS, IT, JO, KM, KW, KZ, LB, LC, LI, LT, LU, LV, LY, MA, MC, MD, ME, MG, MK, ML, MN, MR, MT, MU, MZ, NE, NI, NL, NO, PK, PL, PS, PT, QA, RO, RS, RU, SA, SC, SD, SE, SI, SK, SM, SN, SO, ST, SV, TD, TG, TL, TN, TR, UA, VA, VG, XK

Contributors ✨

This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

License

MIT