UNPKG

@stacrypt/world-countries-info

Version:

List of countries with useful info, and search functions

13 lines (12 loc) 617 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var countries_1 = require("../data/countries"); /** * Finds and returns a country based on it's code (alpha2, alpha3, dialCode) */ var getCountry = function (searchQuery) { var _a, _b; var query = ("" + searchQuery).toUpperCase(); return ((_b = (_a = countries_1.alpha2ToCountries[query]) !== null && _a !== void 0 ? _a : countries_1.alpha2ToCountries[countries_1.alpha3ToAlpha2[query]]) !== null && _b !== void 0 ? _b : countries_1.alpha2ToCountries[countries_1.numericCodeToAlpha2[query]]); }; exports.default = getCountry;