📐 Added more return types

This commit is contained in:
2021-05-05 09:36:33 -07:00
parent 6406bb6ff7
commit c747fa2488

View File

@@ -1,11 +1,11 @@
/* /*
* MIT License * MIT License
* *
* Copyright (c) 2015 Rishi Ghan * Copyright (c) 2021 Rishi Ghan
* *
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015 Rishi Ghan Copyright (c) 2021 Rishi Ghan
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -236,25 +236,23 @@ export const getCovers = async (
options: IExtractionOptions, options: IExtractionOptions,
walkedFolders: Array<IFolderData>, walkedFolders: Array<IFolderData>,
): Promise< ): Promise<
IExtractedComicBookCoverFile[] | IExtractedComicBookCoverFile | unknown | IExtractedComicBookCoverFile
| IExtractComicBookCoverErrorResponse
| IExtractedComicBookCoverFile[]
| (
| IExtractedComicBookCoverFile
| IExtractComicBookCoverErrorResponse
| IExtractedComicBookCoverFile[]
)[]
> => { > => {
switch (options.extractionMode) { switch (options.extractionMode) {
case "bulk": case "bulk":
const extractedDataPromises = _.map(walkedFolders, async (folder) => { const extractedDataPromises = _.map(walkedFolders, async (folder) => {
return await extractArchive( return await extractArchive(options, folder);
{
extractTarget: options.extractTarget,
sourceFolder: options.sourceFolder,
targetExtractionFolder: options.targetExtractionFolder,
paginationOptions: options.paginationOptions,
extractionMode: options.extractionMode,
},
folder,
);
}); });
return Promise.all(extractedDataPromises).then((data) => data); return Promise.all(extractedDataPromises).then((data) => data);
case "single": case "single":
break; return await extractArchive(options, walkedFolders[0]);
} }
}; };