UNPKG

ariaa

Version:
17 lines 650 B
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); function getGenre(given) { const main = ["Pop", "Rock", "Hip Hop", "Latin", "Dance", "R&B", "Classical", "Folk", "Metal", "Rap", "K-Pop"]; return main.find((g) => given.some((r) => r.toUpperCase() === g.toUpperCase())) ?? toTitleCase(given[0]); } __name(getGenre, "getGenre"); function toTitleCase(str) { return str?.replace(/\w\S*/g, (txt) => { return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(); }); } __name(toTitleCase, "toTitleCase"); export { getGenre }; //# sourceMappingURL=genre.js.map