ggez-banking-sdk
Version:
A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.
28 lines (27 loc) • 885 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCountryName = getCountryName;
exports.getCountryCodeByISO_A2 = getCountryCodeByISO_A2;
const countries_1 = __importDefault(require("../content/countries"));
function getCountryName(code) {
if (typeof code == "string") {
code = Number(code);
}
const country = countries_1.default.find((country) => {
if (country.Code === code) {
return country;
}
});
return country?.Name ?? "";
}
function getCountryCodeByISO_A2(ISO_A2) {
const country = countries_1.default.find((country) => {
if (country.ISO_A2 === ISO_A2) {
return country;
}
});
return country?.Code ?? 0;
}