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 โฆ