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
*
* @returns {[FormattedEpisodes]}
* @returns {[FormattedEpisode]}
*/
export async function getEpisodes (entry) {
try {
/** @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
.map(({ id, source, number }) => ({
id,
source,
number,
title: `${entry.title} - ${number}`,
url: [BASE_URL, decrypt(source)].join('')
}))
.filter(({ url }) => url)

View File

@ -48,3 +48,15 @@
* @property {String} FormattedEpisode.source
* @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