UNPKG

country-state-city-slim

Version:

Library for fetching Country, its States and Cities (without Cities...)

26 lines (25 loc) 1.07 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var country_json_1 = __importDefault(require("../assets/country.json")); var utils_1 = require("../utils"); // Get a country by isoCode. function getCountryByCode(isoCode) { return utils_1.findEntryByCode(country_json_1.default, isoCode === null || isoCode === void 0 ? void 0 : isoCode.toUpperCase()); } // Get a list of all countries. function getAllCountries() { return country_json_1.default; } // Check if a country is part of the European Union (by country code) function isEuropeanUnion(isoCode) { var _a; return ((_a = getCountryByCode(isoCode === null || isoCode === void 0 ? void 0 : isoCode.toUpperCase())) === null || _a === void 0 ? void 0 : _a.internationalOrganization) == "EU"; } exports.default = { getCountryByCode: getCountryByCode, getAllCountries: getAllCountries, isEuropeanUnion: isEuropeanUnion };