title: Formatting phone numbers based on country code
body: <p>I have a database with phone numbers which I would like to format according to the country code of the phone number.</p>
  
  <p>The numbers are currently stored in the following format:</p>
  
  <pre><code>+[country_code][number] (like +4512345678)
  </code></pre>
  
  <p>What I need is some kind of library for javascript, that based on the country code can format the number according to the official national format (<a href="http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers" rel="noreferrer">http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers</a>). Below are some examples of how some of the numbers could be formatted</p>
  
  <pre><code>+4512345678 =&gt; +45 12 34 56 78
  +12892708970 =&gt; (289) 270-8970
  </code></pre>
  
  <p>I have found this Java-library here <a href="https://code.google.com/p/libphonenumber/" rel="noreferrer">https://code.google.com/p/libphonenumber/</a>, which bascially solves the problem. However I would like a simple Javascript-solution, which they actually demonstrate on their page, but I cannot find any official downloads to the file file they use, making me wonder if a better solution exists?</p>