Usage Documentation


Here are some examples which check given country code or name is part of EU or not.

import { isEUCountry } from "eu-country-check";

// using country name
console.log(isEUCountry("Austria")); // { name: 'Austria', alpha2: 'AT', alpha3: 'AUT', numeric: '040' }

// using alpha2 code
console.log(isEUCountry("AT")); // { name: 'Austria', alpha2: 'AT', alpha3: 'AUT', numeric: '040' }

// using alpha3 code
console.log(isEUCountry("AUT")); // { name: 'Austria', alpha2: 'AT', alpha3: 'AUT', numeric: '040' }

// using numeric code
console.log(isEUCountry("040")); // { name: 'Austria', alpha2: 'AT', alpha3: 'AUT', numeric: '040' }

// return undefined when country code or country name isn't part of EU
console.log(isEUCountry("NO")); // undefined

Here are some examples which check given country code or name is part of EEA or not.

import { isEEACountry } from "eu-country-check";

// using country name
console.log(isEEACountry("Norway")); // { name: 'Norway', alpha2: 'NO', alpha3: 'NOR', numeric: '578' }

// using alpha2 code
console.log(isEEACountry("NO")); // { name: 'Norway', alpha2: 'NO', alpha3: 'NOR', numeric: '578' }

// using alpha3 code
console.log(isEEACountry("NOR")); // { name: 'Norway', alpha2: 'NO', alpha3: 'NOR', numeric: '578' }

// using numeric code
console.log(isEEACountry("578")); // { name: 'Norway', alpha2: 'NO', alpha3: 'NOR', numeric: '578' }

// return undefined when country code or country name isn't part of EEA
console.log(isEEACountry("CA")); // undefined