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

iranian-bank-detector

v1.0.1

Published

Detect Iranian banks from card numbers with Luhn validation, formatting, and full TypeScript support

Downloads

21

Readme

iranian-bank-detector

npm version npm downloads License: MIT TypeScript Bundle Size

Detect Iranian banks from card numbers. Validate with Luhn. Format for display. Zero dependencies.

🔗 Live Demo

Installation

npm install iranian-bank-detector
yarn add iranian-bank-detector
pnpm add iranian-bank-detector
bun add iranian-bank-detector

Quick Start

import { detectBank, validateCard, formatWithSpaces } from 'iranian-bank-detector';

// Detect bank
const bank = detectBank('6037991234567890');
// → { bankName: 'meli', bankTitle: 'بانک ملی ایران', ... }

// Validate card
const isValid = validateCard('6037991234567890').isValid;
// → true

// Format for display
const formatted = formatWithSpaces('6037991234567890');
// → '6037 9912 3456 7890'

Features

  • 🏦 Bank Detection — Identify 30+ Iranian banks from card prefix
  • Luhn Validation — Verify card number checksum
  • 📝 Formatting — Display cards with spaces, dashes, or custom separators
  • 🔒 Masking — Hide middle digits for security
  • 🎯 TypeScript — Full type definitions included
  • 📦 Zero Dependencies — Lightweight (~8KB minified)
  • 🌳 Tree-shakeable — Import only what you need

API

Bank Detection

import { detectBank, getBankName, getBankLogo, getAllBanks } from 'iranian-bank-detector';

detectBank('6037991234567890');
// → { cardPrefix: 603799, bankName: 'meli', bankTitle: 'بانک ملی ایران', bankLogo: '...', color: '#1a00e0' }

getBankName('6037991234567890');  // → 'بانک ملی ایران'
getBankLogo('6037991234567890');  // → '/images/BankLogo/meli.svg'
getAllBanks();                    // → BankInfo[]

Validation

import { validateCard, validateLuhn, isValidCard } from 'iranian-bank-detector';

validateCard('6037991234567890');
// → { isValid: true, isLuhnValid: true, isLengthValid: true, bank: {...} }

validateLuhn('6037991234567890'); // → true
isValidCard('6037991234567890');  // → true

Formatting

import { formatWithSpaces, formatWithDashes, maskCard } from 'iranian-bank-detector';

formatWithSpaces('6037991234567890'); // → '6037 9912 3456 7890'
formatWithDashes('6037991234567890'); // → '6037-9912-3456-7890'
maskCard('6037991234567890');         // → '6037 99** **** 7890'

Why This Package?

| Feature | iranian-bank-detector | Others | |---------|:---------------------:|:------:| | TypeScript support | ✅ | ⚠️ | | Zero dependencies | ✅ | ❌ | | Luhn validation | ✅ | ⚠️ | | Card formatting | ✅ | ❌ | | Card masking | ✅ | ❌ | | Tree-shakeable | ✅ | ❌ | | 30+ banks supported | ✅ | ⚠️ |

Supported Banks

| Bank | Persian | Prefix(es) | |------|---------|------------| | Meli | بانک ملی ایران | 603799 | | Mellat | بانک ملت | 610433 | | Saderat | بانک صادرات | 603769 | | Tejarat | بانک تجارت | 627353, 585983 | | Sepah | بانک سپه | 589210, 627381, 639370, 639599, 636949 | | Parsian | بانک پارسیان | 622106 | | Pasargad | بانک پاسارگاد | 502229 | | Saman | بانک سامان | 621986 | | Keshavarzi | بانک کشاورزی | 603770 | | Maskan | بانک مسکن | 628023 | | Refah | بانک رفاه | 589463 | | Shahr | بانک شهر | 504706, 502806 | | Ayandeh | بانک آینده | 636214 | | Sina | بانک سینا | 639346 | | Dey | بانک دی | 502938 | | Karafarin | بانک کارآفرین | 627488, 502910 | | ...and more | | |

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

License

MIT © Max Base


تشخیص بانک ایرانی

تشخیص بانک از شماره کارت | اعتبارسنجی Luhn | فرمت‌بندی | بدون وابستگی

نصب

npm install iranian-bank-detector

شروع سریع

import { detectBank, validateCard, formatWithSpaces } from 'iranian-bank-detector';

// تشخیص بانک
const bank = detectBank('6037991234567890');
console.log(bank.bankTitle); // 'بانک ملی ایران'

// اعتبارسنجی
const isValid = validateCard('6037991234567890').isValid; // true

// فرمت‌بندی
const formatted = formatWithSpaces('6037991234567890'); // '6037 9912 3456 7890'

ویژگی‌ها

  • 🏦 تشخیص ۳۰+ بانک ایرانی
  • ✅ اعتبارسنجی با الگوریتم Luhn
  • 📝 فرمت‌بندی شماره کارت
  • 🔒 مخفی‌سازی ارقام میانی
  • 🎯 پشتیبانی کامل TypeScript
  • 📦 بدون وابستگی خارجی

مجوز

MIT