A Moroccan utility library for working with CIN, phone numbers, currency, addresses, dates, and more.
npm install zellige.js

Tiles of Moroccan Utilities

Zellige.js is a simple, powerful utility package designed to handle all the boring stuffโlike validating CINs, phone numbers, IBANs, RIBs, and passportsโspecific to Morocco.
Let's face itโyouโre tired of Googling how to validate a CIN, phone number, IBAN, or passport every time you start a new project. And if you're like most developers, you probably end up copying and pasting validation code from old projects or Stack Overflow, only to realize it's never quite right.
With Zellige.js, you get everything you need in one packageโproperly validated and tested for Morocco-specific fields. It saves you time, reduces errors, and means you donโt have to rewrite the same functions over and over again.
Why spend time reinventing the wheel when you could just install Zellige and move on to the more important tasks?
``typescript
import { validateCIN } from 'zellige.js';
// Simple and intuitive API
const result = validateCIN('AB123456');
`
- ๐ Advanced validation algorithms
- ๐จ Flexible formatting options
- ๐ข Region and office information extraction
- ๐ก๏ธ Built-in security features
- ๐ฑ Support for all Moroccan carriers
- ๐ International format conversion
- โจ Smart formatting options
- โก Carrier detection
- ๐ฆ Support for major Moroccan banks
- ๐ข RIB validation
- ๐ Bank information extraction
- ๐ Secure handling
- ๐ Moroccan passport validation
- ๐ Series and number validation
`bash`
npm install zellige.jsor
yarn add zelligeor
pnpm add zellige
`typescript
import { formatCIN, validatePhoneNumber, getBankInfo } from 'zellige.js';
// Format a CIN
const formattedCIN = formatCIN('AB123456', {
format: 'spaced',
case: 'upper',
}); // => 'AB 123 456'
// Validate a phone number
const isValidPhone = validatePhoneNumber('+212612345678');
// Get bank information
const bankDetails = getBankInfo('007123456789012345678901');
`
Zellige is built with TypeScript at its core, providing:
`typescript
interface CINOptions {
format: 'spaced' | 'dashed' | 'compact';
case: 'upper' | 'lower';
includeMeta?: boolean;
}
// All functions come with detailed type definitions
const result: CINValidationResult = validateCIN('AB123456');
``
We welcome contributions! Whether it's:
- ๐ Bug fixes
- โจ New features
- ๐ Documentation improvements
- ๐งช Additional test cases
Check out our Contributing Guide to get started.
Zellige is MIT licensed. See the LICENSE file for details.
- ๐ Report a bug
- ๐ก Request a feature
- ๐ค Ask a question
- โ
Comprehensive error handling
- ๐ Input sanitization
- โก Performance optimized
- ๐งช Extensive test coverage
- ๐ Detailed documentation
Built with โค๏ธ for the Moroccan developer community