nigerian-mobile-validator
Version:
The most rigorous, up-to-date library for validating Nigerian mobile numbers. Fully NCC-compliant, and security-focused, with enterprise-grade features to prevent the business risks of validation failures in regulated industries.
38 lines (37 loc) • 1.52 kB
TypeScript
import { TelcoNumberAllocation } from './telco-number-allocation';
/**
* Represents the official NCC mobile numbering plan for Nigeria.
* Last updated based on March 2025 NCC data.
*/
export declare class MobileNumberingPlan {
private readonly networkCodeMap;
private initialized;
/**
* Searches the national mobile numbering plan for the number range to which
* the given local number belongs.
*
* @param localNumber The local number to search for
* @returns The TelcoNumberAllocation if found, null otherwise
*/
search(localNumber: number): TelcoNumberAllocation | null;
/**
* Initialize the map structure without loading all the data
*/
private lazyInitialize;
/**
* Load data for a specific network code
*
* This method implements a lazy loading strategy to optimize performance.
* Instead of loading the entire numbering plan at initialization (which would
* cause startup delays), we only load data for specific network codes when
* they are first encountered during a search operation.
*
* The workflow is:
* 1. When a search is performed, we check if we have allocation data for the network code
* 2. If the array exists but is empty, we call this method to load just that network code's data
* 3. This keeps memory usage low and avoids unnecessary initialization time
*
* @param networkCode The network code to load allocation data for
*/
private loadNetworkCodeData;
}