phone library
Pakistani mobile number validation, formatting and analysis.
Same as the pakdatakit/phone entry point of the npm package.
Classes
- PhoneAnalysis
- Combined phone validation, formatting and network analysis result. See analyzePhone.
Enums
- NetworkName
- Original issuing operator for a mobile prefix.
Functions
-
analyzePhone(
String phone) → PhoneAnalysis - Validates, formats and detects the network of a mobile number in one call.
-
formatPhone(
String phone) → String? -
Formats a Pakistani mobile number in E.164 style (
+923001234567). -
getPhonePrefix(
String phone) → String? -
Returns the local mobile prefix (
0XXX) of a phone number, ornullif it is not a valid Pakistani mobile number. -
normalizePhoneDigits(
String phone) → String? -
Normalizes a phone string to digits with country code (no leading plus),
such as
923001234567. -
validatePhone(
String phone) → bool - Validates a Pakistani mobile phone number.