UNPKG

bandcamp-fetch

Version:
36 lines 1.8 kB
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _a, _ShowListParser_getShowUrl; import { URLS } from '../utils/Constants.js'; class ShowListParser { static parseList(json, opts) { const shows = []; if (typeof json === 'object' && Array.isArray(json.results)) { json.results.forEach((show) => { const parsed = { type: 'show', name: show.title, url: __classPrivateFieldGet(this, _a, "m", _ShowListParser_getShowUrl).call(this, show.id), publishedDate: show.published_date, description: show.desc, imageCaption: show.image_caption, subtitle: show.subtitle, screenImageUrl: `${opts.imageBaseUrl}/img/${show.v2_image_id}_0` }; if (show.v2_image_id && opts.imageFormat?.id) { parsed.imageUrl = `${opts.imageBaseUrl}/img/${show.v2_image_id}_${opts.imageFormat.id}.jpg`; } shows.push(parsed); }); } return shows; } } _a = ShowListParser, _ShowListParser_getShowUrl = function _ShowListParser_getShowUrl(showId) { return `${URLS.SITE_URL}/?show=${showId}`; }; export default ShowListParser; //# sourceMappingURL=ShowListParser.js.map