iranian-phone-validator
v1.0.0
Published
A simple utility to validate and format Iranian phone numbers.
Readme
Iranian Phone Validator
A simple utility to validate and format Iranian phone numbers.
Installation
npm install iranian-phone-validatorUsage
const validateIranianPhoneNumber = require("iranian-phone-validator");
const result = validateIranianPhoneNumber("09123456789");
console.log(result);
// Output: { isValid: true, formatted: '0912 345 6789', message: 'Valid Iranian phone number.' }API
validateIranianPhoneNumber(phoneNumber)
- phoneNumber:
string- The input phone number to validate. - Returns:
objectisValid:boolean- Indicates if the phone number is valid.formatted:string|null- The formatted phone number, ornullif invalid.message:string- A descriptive message about the validation result.
License
MIT
