egyptian-nationalid
v1.1.0
Published
A powerful Egyptian National ID parser and validator. Extract birth date, governorate, gender, and more.
Maintainers
Readme
Egyptian National ID Parser & Validator 🇪🇬
A professional, feature-rich TypeScript library and CLI tool for parsing and validating Egyptian National IDs.
🚀 Features
- Accurate Parsing: Extract birth date, age, gender, and governorate.
- Strict Validation: Ensures the ID follows the official Egyptian standards.
- Beautiful CLI: Modern terminal interface with Egyptian flag styling.
- Multi-language: Support for both Arabic and English data extraction.
- TypeScript Ready: Full type definitions included.
- Zero Dependencies: (CLI uses
commander).
💻 CLI Usage
You can use the tool directly from your terminal.
Global Installation
Install it globally to access the egyid command from anywhere:
Using npm:
npm install -g egyptian-nationalidUsing pnpm:
pnpm add -g egyptian-nationalidBasic Usage
# Parse an ID (English output)
egyid 29505050217415
# Parse an ID (Arabic output)
egyid 29505050217415 -a
# Validate an ID only
egyid validate 29505050217415
# Get JSON output
egyid 29505050217415 --jsonRun without installing (NPX)
npx egyptian-nationalid 29505050217415 -a📦 Library Installation
Using npm:
npm install egyptian-nationalidUsing pnpm:
pnpm add egyptian-nationalid🛠 Usage (Code)
Basic Validation
import { isValid } from 'egyptian-nationalid';
console.log(isValid('29505050217415')); // trueData Extraction
import { getInformation } from 'egyptian-nationalid';
const info = getInformation('29505050217415', 'arabic');
console.log(info);
/*
{
valid: true,
national_id: '29505050217415',
type: 'ذكر',
gender: 'male',
century: '1900s',
age: 30,
governorate: 'الإسكندرية',
governorate_code: '02',
birthday: { ... }
}
*/🎨 Professional Design
The CLI is designed to be expressive and clear, featuring a stylized Egyptian flag and high-contrast labels that work across all terminal themes (Dark & Light).
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
