degachejs
Version:
A Tunisian utility library for working with CIN, phone numbers, addresses, and more
28 lines (27 loc) • 1 kB
TypeScript
import { Carrier } from "../types";
/**
* Options for phone number validation
*/
export interface PhoneNumberValidationOptions {
/**
* When true, enforces strict format validation:
* - No spaces or special characters allowed
* - Must be exactly 8 digits or with +216 prefix
* - Must start with a valid carrier prefix
*/
strict?: boolean;
}
/**
* Validates a Tunisian phone number
* @param phoneNumber - The phone number to validate
* @param options - Validation options
* @returns boolean indicating if the phone number is valid
*/
export declare const validatePhoneNumber: (phoneNumber: string, options?: PhoneNumberValidationOptions) => boolean;
/**
* Gets carrier information from a phone number
* @param phoneNumber - The phone number to check
* @param options - Validation options
* @returns carrier information or null if invalid
*/
export declare const getCarrierInfo: (phoneNumber: string, options?: PhoneNumberValidationOptions) => Carrier | null;