Built to simplify common tasks for Tunisian developers — from CIN & RIB validation to phone number formatting and tax ID checks.
# 🌴 degache.js
Tunisian Developer's Essential Utility Library
## Why degache.js? 🤔
Tired of rewriting validation code for Tunisian CIN, phone numbers, and tax IDs? `degache.js` is your go-to utility library for all things Tunisian! Named after the beautiful oasis city of Degache, this library brings the same refreshing relief to your development workflow.
## 🚀 Features
### CIN (Carte d'Identité Nationale) 🆔
```typescript
import { validateCIN } from 'degachejs';
// Simple validation
const isValid = validateCIN('12345678'); // true
```
### Phone Numbers 📱
- ✅ Support for all Tunisian carriers (Ooredoo, Orange, Tunisie Telecom)
- 🔄 International format conversion
- 📞 Smart formatting with country code
- 🏢 Carrier detection
- 🔒 Strict mode validation
```typescript
import { validatePhoneNumber, formatPhoneNumber, getCarrierInfo } from 'degachejs';
// Validate phone number
const isValid = validatePhoneNumber('20123456'); // true
// Validate with strict mode (no spaces or special characters allowed)
const isStrictValid = validatePhoneNumber('20 123 456', { strict: true }); // false
// Format phone number
const formatted = formatPhoneNumber('20123456');
console.log(formatted); // +216 20 123 456
// Get carrier information
const carrier = getCarrierInfo('20123456');
console.log(carrier); // { name: 'Ooredoo', prefixes: ['2'] }
```
### Tax ID (Matricule Fiscal) 💼
```typescript
import { validateTaxID } from 'degachejs';
const isValid = validateTaxID('1234567A/P/M/000');
```
### Currency Formatting 💰
```typescript
import { formatCurrency } from 'degachejs';
const amount = formatCurrency(1234.56);
console.log(amount); // 1.234,560 دينار تونسي
```
### Postal Codes 📮
```typescript
import { validatePostalCode } from 'degachejs';
const isValid = validatePostalCode('1000'); // true for Tunis
```
### Car Plates 🚗
```typescript
import { validateCarPlate, getCarPlateInfo } from 'degachejs';
// Validate car plate (Arabic format: XXX تونس XXXX)
const isValid = validate …