tcra-num-check
Version:
Tanzanian number validator with reference to the national numbering plan and signaling point code plan
84 lines • 4.37 kB
JavaScript
;
/**
* TCRA Number Check - Tanzanian Phone Number Validator
*
* A comprehensive TypeScript library for validating Tanzanian phone numbers
* according to the TCRA (Tanzania Communications Regulatory Authority)
* National Numbering Plan and Signaling Point Codes Plan.
*
* This package covers all aspects of the numbering plan including:
* - Mobile and fixed line number validation
* - Emergency services and short codes
* - Signaling point codes (STP, HLR, VLR, etc.)
* - Number portability and carrier selection
* - Special service numbers (toll-free, premium rate, etc.)
* - Number formatting and querying capabilities
* - Comprehensive statistics and reporting
* - Multiple validation modes (basic, full, custom)
*
* @example
* ```typescript
* import { TCRANumberValidator, NumberType, ValidatorMode } from 'tcra-num-check';
*
* // Basic mode - only mobile and fixed line validation
* const basicValidator = new TCRANumberValidator({ mode: 'basic' });
*
* // Full mode - all features enabled
* const fullValidator = new TCRANumberValidator({ mode: 'full' });
*
* // Custom mode with specific features
* const customValidator = new TCRANumberValidator({
* mode: 'custom',
* features: {
* validateMobile: true,
* validateEmergency: true,
* validateSignalingPoint: false
* }
* });
*
* // Validate a mobile number
* const result = basicValidator.validate('0712345678');
* console.log(result.isValid); // true
* console.log(result.numberType); // NumberType.MOBILE
* console.log(result.operator); // 'Airtel Tanzania'
*
* // Validate with portability check
* const resultWithPortability = fullValidator.validate('0712345678', {
* checkPortability: true
* });
* console.log(resultWithPortability.portabilityStatus); // PortabilityStatus.PORTABLE
*
* // Format to international
* const international = basicValidator.formatInternational('0712345678');
* console.log(international); // '+255712345678'
*
* // Query numbering plan
* const mobileNumbers = fullValidator.queryNumberingPlan({
* numberType: NumberType.MOBILE
* });
*
* // Get statistics
* const stats = fullValidator.getNumberingPlanStatistics();
* console.log(stats.totalNumbers); // Total available numbers
* ```
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CarrierSelections = exports.NumberStatuses = exports.PortabilityStatuses = exports.NumberTypes = exports.CUSTOM_MODE_FEATURES = exports.FULL_MODE_FEATURES = exports.BASIC_MODE_FEATURES = exports.mergeFeatures = exports.getDefaultFeatures = exports.TANZANIAN_NUMBERING_PLAN = exports.TCRANumberValidator = void 0;
var validator_1 = require("./validator");
Object.defineProperty(exports, "TCRANumberValidator", { enumerable: true, get: function () { return validator_1.TCRANumberValidator; } });
var numberingPlan_1 = require("./numberingPlan");
Object.defineProperty(exports, "TANZANIAN_NUMBERING_PLAN", { enumerable: true, get: function () { return numberingPlan_1.TANZANIAN_NUMBERING_PLAN; } });
// Export configuration
var config_1 = require("./config");
Object.defineProperty(exports, "getDefaultFeatures", { enumerable: true, get: function () { return config_1.getDefaultFeatures; } });
Object.defineProperty(exports, "mergeFeatures", { enumerable: true, get: function () { return config_1.mergeFeatures; } });
Object.defineProperty(exports, "BASIC_MODE_FEATURES", { enumerable: true, get: function () { return config_1.BASIC_MODE_FEATURES; } });
Object.defineProperty(exports, "FULL_MODE_FEATURES", { enumerable: true, get: function () { return config_1.FULL_MODE_FEATURES; } });
Object.defineProperty(exports, "CUSTOM_MODE_FEATURES", { enumerable: true, get: function () { return config_1.CUSTOM_MODE_FEATURES; } });
// Export enums for convenience
var types_1 = require("./types");
Object.defineProperty(exports, "NumberTypes", { enumerable: true, get: function () { return types_1.NumberType; } });
Object.defineProperty(exports, "PortabilityStatuses", { enumerable: true, get: function () { return types_1.PortabilityStatus; } });
Object.defineProperty(exports, "NumberStatuses", { enumerable: true, get: function () { return types_1.NumberStatus; } });
Object.defineProperty(exports, "CarrierSelections", { enumerable: true, get: function () { return types_1.CarrierSelection; } });
//# sourceMappingURL=index.js.map