Skip to content

Commit

Permalink
format before release
Browse files Browse the repository at this point in the history
  • Loading branch information
AkioSarkiz committed Sep 29, 2024
1 parent bc7a8ea commit 88a857d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions src/external-sources/manga-updates-external-source-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MangaUpdatesExternalSourceMatcher implements ExternalSourceMatcher
const isTitleMatchInAlternativeNames = series.associated
.map((v) => v.title.toLowerCase())
.some((formattedAssociatedTitle) =>
compareDiacriticsStrings(formattedAssociatedTitle, this.detailedManga.title.toLowerCase())
compareDiacriticsStrings(formattedAssociatedTitle, this.detailedManga.title.toLowerCase()),
);

const isAuthorMatch = series.authors
Expand All @@ -40,8 +40,8 @@ export class MangaUpdatesExternalSourceMatcher implements ExternalSourceMatcher

return Boolean(
formattedMangaAuthors?.some((formattedMangaAuthor) =>
compareDiacriticsStrings(formattedMangaAuthor, formattedSeriesAuthor)
)
compareDiacriticsStrings(formattedMangaAuthor, formattedSeriesAuthor),
),
);
});

Expand All @@ -52,8 +52,8 @@ export class MangaUpdatesExternalSourceMatcher implements ExternalSourceMatcher

return Boolean(
formattedMangaArtists?.some((formattedMangaArtist) =>
compareDiacriticsStrings(formattedMangaArtist, formattedSeriesAuthor)
)
compareDiacriticsStrings(formattedMangaArtist, formattedSeriesAuthor),
),
);
});

Expand Down
10 changes: 5 additions & 5 deletions src/external-sources/my-anime-list-external-source-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MyAnimeListExternalSourceMatcher implements ExternalSourceMatcher {
const isTitleMatchInAlternativeNames = manga.titles
.map((v) => v.title)
.some((formattedAssociatedTitle) =>
compareDiacriticsStrings(formattedAssociatedTitle, this.detailedManga.title)
compareDiacriticsStrings(formattedAssociatedTitle, this.detailedManga.title),
);

const isAuthorMatch = manga.authors
Expand All @@ -40,8 +40,8 @@ export class MyAnimeListExternalSourceMatcher implements ExternalSourceMatcher {

return Boolean(
formattedMangaAuthors?.some((formattedMangaAuthor) =>
compareDiacriticsStrings(formattedMangaAuthor, formattedSeriesAuthor)
)
compareDiacriticsStrings(formattedMangaAuthor, formattedSeriesAuthor),
),
);
});

Expand All @@ -52,8 +52,8 @@ export class MyAnimeListExternalSourceMatcher implements ExternalSourceMatcher {

return Boolean(
formattedMangaArtists?.some((formattedMangaArtist) =>
compareDiacriticsStrings(formattedMangaArtist, formattedSeriesAuthor)
)
compareDiacriticsStrings(formattedMangaArtist, formattedSeriesAuthor),
),
);
});

Expand Down
4 changes: 2 additions & 2 deletions src/functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function urlJoin(...parts: string[]): string {
return parts
.map((part) => part.replace(/(^\/+|\/+$)/g, '')) // Remove leading/trailing slashes from each part
.map((part) => part.replace(/(^\/+|\/+$)/g, "")) // Remove leading/trailing slashes from each part
.filter((part) => part.length > 0) // Remove any empty parts
.join('/'); // Join parts with a single slash
.join("/"); // Join parts with a single slash
}
4 changes: 2 additions & 2 deletions src/providers/mangafire/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class MangafireScraper implements Scraper {
}

const { data }: { data: { result: { images: Array<string[]> } } } = await axios.get(
urlJoin(this.baseUrl, `ajax/read/chapter/${realChapterId}`)
urlJoin(this.baseUrl, `ajax/read/chapter/${realChapterId}`),
);

data.result.images.forEach((image, i) => {
Expand Down Expand Up @@ -212,7 +212,7 @@ export class MangafireScraper implements Scraper {

return await this.parseDashboardPage(
`filter?keyword=${encodeURI(query)}&language[]=en&sort=release_date&page=${page}`,
page
page,
);
}
}
8 changes: 4 additions & 4 deletions src/providers/toonily/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class ToonilyScraper implements Scraper {
.split("/")
.at(-1)
: page !== undefined
? page
: 1
? page
: 1,
);

return {
Expand Down Expand Up @@ -227,8 +227,8 @@ export class ToonilyScraper implements Scraper {
.split("/")
.at(-1)
: page !== undefined
? page
: 1
? page
: 1,
);

return {
Expand Down
6 changes: 3 additions & 3 deletions src/types/external-source-matcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export interface ExternalSourceMatcher {
* @example example of getting the name
* ``ts
* const name = externalSourceMatcher.getSourceName();
*
*
* console.log(name); // "manga-updates"
* ```
*/
public getSourceName(): string;
getSourceName(): string;

/**
* Tries to match the manga with the external source.
Expand All @@ -25,5 +25,5 @@ export interface ExternalSourceMatcher {
* console.log(matchedManga.externalSources);
* ```
*/
public tryMatchExternalSource(): Promise<ScrapedDetailedManga>;
tryMatchExternalSource(): Promise<ScrapedDetailedManga>;
}
24 changes: 12 additions & 12 deletions src/types/scraper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export type ScrapedListOfManga = {
* Total count of manga
*/
totalData?: number;

/**
* Total count of pages
*/
Expand All @@ -102,47 +102,47 @@ export type ScrapedListOfManga = {
export interface Scraper {
/**
* Initialization of scraper, it should be called before any other method
*
*
* @returns Promise<void>
*/
init: () => Promise<void>;

/**
* Shutdown of scraper, it should be called after any other method
*
*
* @returns Promise<void>
*/
shutdown: () => Promise<void>;

/**
* Get detailed information about manga by url
*
* @param {string} url
*
* @param {string} url
* @returns {Promise<ScrapedDetailedManga>}
*/
getDetailedManga: (url: string) => Promise<ScrapedDetailedManga>;

/**
* Get detailed information about chapter by url
*
* @param {string} url
*
* @param {string} url
* @returns {Promise<ScrapedDetailedChapter>}
*/
getDetailedChapter: (url: string) => Promise<ScrapedDetailedChapter>;

/**
* Get latest updates
*
* @param {number} page
*
* @param {number} page
* @returns {Promise<ScrapedListOfManga>}
*/
getLatestUpdates: (page?: number) => Promise<ScrapedListOfManga>;

/**
* Search manga with query
*
* @param {string} search query
* @param {number} page
*
* @param {string} search query
* @param {number} page
* @returns {Promise<ScrapedListOfManga>}
*/
search: (query: string, page?: number) => Promise<ScrapedListOfManga>;
Expand Down

0 comments on commit 88a857d

Please sign in to comment.