beerbay-math
Version:
26 lines (21 loc) • 628 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSelectedCountry = void 0;
/**
* @method getSelectedCountry
* @description Given a Country Name, return the data for it
* @param {String} name
*/
var getSelectedCountry = function getSelectedCountry(id) {
var counties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var found = counties.find(function (country) {
return parseInt(country.id) === parseInt(id);
});
if (!found) {
throw new Error("Can't find country");
}
return found;
};
exports.getSelectedCountry = getSelectedCountry;