Skip to content

Releases: HuluWZ/phone-formatter-eth

v1.1.8 ```parse`` cleans up and normalize phone numbers

31 Aug 07:18
387c417
Compare
Choose a tag to compare

v1.1.8 parse cleans up and normalize phone numbers

Usage

const {  parse} = require('phone-formater-eth');
  
  Or

import {  parse } from 'phone-formater-eth';

  1. parse - Parse phone number to remove special characters like '-' and '(' ')'
    Parameters - phone (string): The phone number to cleaned.
    Returns - (string): The cleaned phone number if the phone is valid else "INVALID_PHONE_NUMBER"

    Examples

console.log(parse("(251) 911-123-456")); //25191112456
console.log(parse("(251) 911-123-456")); //25191112456
console.log(parse("251-911-123-456"));   //25191112456
console.log(parse("2519-11-123-456"));   //25191112456

v1.1.7 formatPhone with local & int'l option

25 Aug 08:29
Compare
Choose a tag to compare

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

v1.1.4: feat: implemented ``isValid``` check for if it's valid phone number o…

19 Aug 08:10
Compare
Choose a tag to compare

Updates

  • implemented isValid method - to Returns boolean if it’s Valid phone number or not