Skip to content

v1.1.7 formatPhone with local & int'l option

Compare
Choose a tag to compare
@HuluWZ HuluWZ released this 25 Aug 08:29
· 3 commits to main since this release

const { formatPhone, checkOperator, isValid } = require('phone-formater-eth');

  1. Included another parametet for formatPhone method with type ("local" | "international") by default it's "international"

console.log(formatPhone('0912345678')); // Outputs: +251912345678 - international format console.log(formatPhone('+251712345678',"local")); // Outputs: 0712345678

  1. isValid - Checks if phone number is valid or not

console.log(isValid('251912345678')); // Outputs: true console.log(isValid('0812345678')); // Outputs: fals