mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 15:33:26 +00:00
Removed duplicate code in getAllSources
This commit is contained in:
@@ -43,30 +43,15 @@ const sources = getAllSources();
|
|||||||
function getAllSources() {
|
function getAllSources() {
|
||||||
// * The only way to get a list of all sources is to
|
// * The only way to get a list of all sources is to
|
||||||
// * create all these things. Maybe this should change
|
// * create all these things. Maybe this should change
|
||||||
const nativeSources = makeProviders({
|
const providers = makeProviders({
|
||||||
fetcher: makeStandardFetcher(nodeFetch),
|
fetcher: makeStandardFetcher(nodeFetch),
|
||||||
target: targets.NATIVE
|
target: targets.NATIVE
|
||||||
}).listSources();
|
})
|
||||||
|
|
||||||
const browserSources = makeProviders({
|
const sources = providers.listSources();
|
||||||
fetcher: makeStandardFetcher(nodeFetch),
|
const embeds = providers.listEmbeds();
|
||||||
target: targets.BROWSER
|
|
||||||
}).listSources();
|
|
||||||
|
|
||||||
const nativeEmbeds = makeProviders({
|
const combined = [...sources, ...embeds];
|
||||||
fetcher: makeStandardFetcher(nodeFetch),
|
|
||||||
target: targets.NATIVE
|
|
||||||
}).listEmbeds();
|
|
||||||
|
|
||||||
const browserEmbeds = makeProviders({
|
|
||||||
fetcher: makeStandardFetcher(nodeFetch),
|
|
||||||
target: targets.BROWSER
|
|
||||||
}).listEmbeds();
|
|
||||||
|
|
||||||
const combined = [
|
|
||||||
...nativeSources, ...browserSources,
|
|
||||||
...nativeEmbeds, ...browserEmbeds
|
|
||||||
];
|
|
||||||
|
|
||||||
// * Remove dupes
|
// * Remove dupes
|
||||||
const map = new Map(combined.map(source => [source.id, source]));
|
const map = new Map(combined.map(source => [source.id, source]));
|
||||||
|
Reference in New Issue
Block a user