Fix jsdoc and added episode title

This commit is contained in:
Kylart 2020-03-31 02:45:58 +02:00
parent 63bd136dae
commit 654621dc41
2 changed files with 15 additions and 2 deletions

View File

@ -35,18 +35,19 @@ export async function getAll () {
* *
* @param {Entry} entry Entry to get the episodes of * @param {Entry} entry Entry to get the episodes of
* *
* @returns {[FormattedEpisodes]} * @returns {[FormattedEpisode]}
*/ */
export async function getEpisodes (entry) { export async function getEpisodes (entry) {
try { try {
/** @type {[RawEpisode]} */ /** @type {[RawEpisode]} */
const rawEps = await https.get(`${API_URL}/anime/${entry.slug.slug}/sources`, [], DEFAULT_HEADERS) const rawEps = await https.get(`${API_URL}/anime/${entry.slug.slug}/sources`, [], { ...DEFAULT_HEADERS, json: true })
return rawEps return rawEps
.map(({ id, source, number }) => ({ .map(({ id, source, number }) => ({
id, id,
source, source,
number, number,
title: `${entry.title} - ${number}`,
url: [BASE_URL, decrypt(source)].join('') url: [BASE_URL, decrypt(source)].join('')
})) }))
.filter(({ url }) => url) .filter(({ url }) => url)

View File

@ -48,3 +48,15 @@
* @property {String} FormattedEpisode.source * @property {String} FormattedEpisode.source
* @property {Number} FormattedEpisode.number * @property {Number} FormattedEpisode.number
*/ */
/** @type {Entry} */
export const Entry = null
/** @type {FormattedEntry} */
export const FormattedEntry = null
/** @type {RawEpisode} */
export const RawEpisode = null
/** @type {FormattedEpisode} */
export const FormattedEpisode = null