/js-phone-number-formatter

Format a phone number in JavaScript

MIT LicenseMIT

js-phone-number-formatter

Format a phone number in JavaScript

Phone numbers are typically formatted into chunks to make them easily readable and memorizable. The patterns are so important that if you view numbers in the wrong format it actually becomes very hard to read.

This function takes a string of digits that make up a phone number and returns the canonical formatted string for that number.

In particular this function attempts to handle all known formats from around the world.