Skip to content

Instantly share code, notes, and snippets.

@walison17
Created July 4, 2019 21:40
Show Gist options
  • Save walison17/f8e8fec37199b52a239300f28e16d783 to your computer and use it in GitHub Desktop.
Save walison17/f8e8fec37199b52a239300f28e16d783 to your computer and use it in GitHub Desktop.
const maskPhone = (phone) => phone.replace(/^(\d{2})(\d{4,5})(\d{4})$/, '($1) $2-$3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment