osu-api-extended
Version:
Advanced osu! api wrapper for v1 and v2, with extra stuff
34 lines (33 loc) • 993 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.country_details = void 0;
const enums_1 = require("../types/enums");
const handleErrors_1 = require("../utility/handleErrors");
const country_details = (name) => {
if (name == null || name == '') {
return (0, handleErrors_1.handleErrors)('Specify country code or country name');
}
;
if (name.length == 2) {
const find = enums_1.CountryNames[name.toUpperCase()];
if (find == null) {
return (0, handleErrors_1.handleErrors)('Country not found');
}
;
return {
code: name.toUpperCase(),
name: find,
};
}
;
const find = enums_1.CountryCodes[name];
if (find == null) {
return (0, handleErrors_1.handleErrors)('Country not found');
}
;
return {
code: name,
name: find,
};
};
exports.country_details = country_details;
;