Skip to content

Introducing e164.js: country from international phone number

by Pascal Deschenes on May 24th, 2012
Rotary Phone

I’ve recently release (over GitHub) a small node module (browser javascript friendly) to deal with international phone number and their origination country as specified by the E.164 standard.

How it works

e162.js doesn’t check whether the phone number is a valid one or not. It simply returns the associated country based on prefix matching. The matcher starts from the last digit and revert lookup until a number matches from the lookup hash.

If a number can’t be found from the lookup hash, number is assumed to be invalid and returns undefined.



Directly from test/test.js


Almost directly from test/index.html


Git Clone

$ git clone git://

Install from npm

$ sudo npm install e164 [-g]


    • return object of the form {country: “”, code: “”}
    • Support for dial out calling prefix could be offered directly or through options hash

You might also be interested in the following related posts:

From → development, howto