Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prefix-number

juliandavidmr716MIT1.0.0

Get the name of the country in three different languages, the prefix and the ISO

number, phone, telephone, prefix, country, cities, iso, iso3, fr, es, en, language

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