UNPKG

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.

42 lines (41 loc) 2.12 kB
import { MobileValidationStatus } from './mobile-validation-status'; import { TelcoNumberAllocation } from '../numbering-plan/telco-number-allocation'; import { IMobileNumber } from './i-mobile-number'; /** * An object representing the result of validating the mobile number provided by the user. */ export declare class MobileNumberValidationResult { private readonly _userProvidedDigits; private readonly _validationStatus; private readonly _validationSucceeded; private readonly _mobileNumber?; private readonly _telcoNumberAllocation?; /** * Create a new MobileNumberValidationResult * * @param userProvidedDigits The original digits input by user * @param validationStatus Status enum representing error or success * @param validationSucceeded Whether validation succeeded * @param mobileNumber The validated mobile number (if successful) * @param telcoNumberAllocation The telco allocation details (if successful) */ constructor(_userProvidedDigits: string, _validationStatus: MobileValidationStatus, _validationSucceeded: boolean, _mobileNumber?: IMobileNumber | undefined, _telcoNumberAllocation?: TelcoNumberAllocation | undefined); /** The original digits input by user. */ get userProvidedDigits(): string; /** Status enum representing error or success message of the validation. */ get validationStatus(): MobileValidationStatus; /** User-friendly message for this validation result */ get userMessage(): string; /** Developer-friendly message for this validation result */ get devMessage(): string; /** Whether validation of a user supplied mobile number was successful. */ get validationSucceeded(): boolean; /** If validation succeeded, the validated MobileNumber. */ get mobileNumber(): IMobileNumber | undefined; /** If validation succeeded, details about the telco allocation. */ get telcoNumberAllocation(): TelcoNumberAllocation | undefined; /** * Create an empty validation result (for initial state). */ static empty(): MobileNumberValidationResult; }