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

iran-bankit

v1.0.2

Published

Iranian bank detection from card numbers and IBAN (Sheba) numbers, with SVG logos, card validation, and Persian currency formatting utilities.

Readme

iran-bankit

شناسایی بانک ایرانی از روی شماره کارت و شماره شبا، همراه با اعتبارسنجی و فرمت‌دهی.

نسخه انگلیسی: README.en.md


نصب

npm i iran-bankit

استفاده

const {
  getBankByCard,
  getBankByIban,
  validateCard,
  validateIbanChecksum,
  formatToCardNumber,
  formatToIban,
  formatLTRNumber,
  currencyFormatter,
  getAllBanks,
} = require('iran-bankit');

شناسایی بانک از شماره کارت

// بلوبانک — به‌درستی شناسایی می‌شود (نه بانک سامان)
getBankByCard('6219861800001234');
// { id: 'blu', nameFa: 'بلوبانک', nameEn: 'Blu Bank', ... }

// بانک سامان
getBankByCard('6219860012345678');
// { id: 'saman', nameFa: 'بانک سامان', ... }

// پذیرش اعداد فارسی/عربی و جداکننده
getBankByCard('۶۱۰۴-۳۳۰۰-۰۰۰۰-۰۰۰۰');
// { id: 'mellat', nameFa: 'بانک ملت', ... }

شناسایی بانک از شماره شبا

// بانک ملی — به‌درستی شناسایی می‌شود (نه بانک دی)
getBankByIban('IR240170000000000000000000');
// { id: 'meli', nameFa: 'بانک ملی ایران', ibanCode: '017', ... }

// بانک دی — به‌درستی شناسایی می‌شود (نه بانک ملی)
getBankByIban('IR240660000000000000000000');
// { id: 'dey', nameFa: 'بانک دی', ibanCode: '066', ... }

// بدون پیشوند IR (۲۴ رقم)
getBankByIban('240170000000000000000000');
// { id: 'meli', ... }

اعتبارسنجی شماره کارت (الگوریتم لوهن)

validateCard('6037990000000006'); // true
validateCard('6037990000000007'); // false
validateCard('۶۰۳۷۹۹۰۰۰۰۰۰۰۰۰۶'); // true — اعداد فارسی
validateCard('6037-9900-0000-0006'); // true — جداکننده

اعتبارسنجی شبا (ISO 7064 mod-97)

validateIbanChecksum('IR820540102680020817909002'); // true
validateIbanChecksum('820540102680020817909002');   // true — بدون IR
validateIbanChecksum('IR820540102680020817909001'); // false

فرمت‌دهی شماره کارت

formatToCardNumber('6037990000000006');
// '6037 9900 0000 0006'

formatToCardNumber('60379900');
// '6037 9900'

فرمت‌دهی شبا

formatToIban('240170012345678901234567');
// '24 0170 0123 4567 8901 2345 67'

formatToIban('2401');
// '24 01'

نمایش عدد چپ‌به‌راست در محیط راست‌به‌چپ

formatLTRNumber('6037990000000006');
// '‎6037990000000006'  (با کاراکتر U+200E در ابتدا)

formatLTRNumber('');
// ''

فرمت‌دهی ارز به فارسی

currencyFormatter(1234567);
// '۱,۲۳۴,۵۶۷'

currencyFormatter('1234567.89');
// '۱,۲۳۴,۵۶۷.۸۹'

currencyFormatter(-5000);
// '-۵,۰۰۰'

currencyFormatter('abc');
// ''

دریافت همه بانک‌ها

const banks = getAllBanks();
// آرایه‌ای از { id, nameEn, nameFa, ibanCode, cardPrefixes }

ساختار شیء بانک

interface Bank {
  id: string;              // شناسه یکتا، مثلاً "meli"، "blu"، "saman"
  nameEn: string;          // نام انگلیسی
  nameFa: string;          // نام فارسی
  ibanCode: string | null; // کد ۳ رقمی شبا؛ null برای بانک‌هایی با مجوز مشترک
  cardPrefixes: string[];  // پیشوندهای ۶ یا ۸ رقمی کارت
}

لایسنس

MIT