v1.1.8 parse cleans up and normalize phone numbers
Usage
const { parse} = require('phone-formater-eth');
Or
import { parse } from 'phone-formater-eth';
- 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