mozambique-utils
Version:
Easy to use parsers and validators for mozambican (🇲🇿) data-type formatted strings.
25 lines (24 loc) • 912 B
TypeScript
import ResultInterface from "./helper/interface/ResultInterface";
import { LineType, NetworkOperatorSpec } from "./helper/type/types";
/**
* Response type for this validation
*/
declare type MobileNumberSpec = {
number: string;
localFormat: string;
internationalFormat: string;
includesCountryCode: boolean;
nationalDestinationCode: string;
operator: NetworkOperatorSpec;
lineType: LineType;
};
/**
* Validates any mozambican mobile number.
*
* @param {string} num The mobile number to check for.
* @returns {MobileNumberValidationResult} an object telling if the provided number str is valid or not. And if valid, some extra details about that number, otherwise null.
*
* @throws if the provided argument is not of type string.
*/
declare const parseMobileNumber: (num: string) => ResultInterface<MobileNumberSpec>;
export default parseMobileNumber;