prefix-number
v1.0.0
Published
Get the name of the country in three different languages, the prefix and the ISO
Downloads
317
Maintainers
Readme
prefix-number
Get the name of the country in three different languages, the prefix and the ISO.
$ npm install --save prefix-number
Usage
By prefix
Import
var Prefixnum = require('prefix-number');
var prefix = new Prefixnum("+57");
console.log(prefix.toISO()); //=> CO
console.log(prefix.toISO3()); //=> COL
console.log(prefix.toCountry()); //=> Colombia
console.log(prefix.toPrefix()); //=> 57
By name
var prefix = new Prefixnum("Australia");
console.log(prefix.toISO()); //=> AU
console.log(prefix.toISO3()); //=> AUS
console.log(prefix.toPrefix()); //=> 61
By ISO
var prefix = new Prefixnum("BG");
console.log(prefix.toISO()); //=> BG
console.log(prefix.toISO3()); //=> BGR
console.log(prefix.toCountry()); //=> Bulgaria
console.log(prefix.toPrefix()); //=> 359
Change language
Available in Spanish, English and French. Default en
.
var prefix = new Prefixnum("United States of America");
prefix.language('es'); // es|en|fr
console.log(prefix.toCountry()); //=> Estados Unidos de América
prefix.language('fr'); // es|en|fr
console.log(prefix.toCountry()); //=> États-Unis d'Amérique
LICENSE
MIT