Removed duplicate code in getAllSources

This commit is contained in:
Jonathan Barrow
2023-09-26 13:24:16 -04:00
parent 6ca9de8d74
commit 6f29b636ea

View File

@@ -43,30 +43,15 @@ const sources = getAllSources();
function getAllSources() {
// * The only way to get a list of all sources is to
// * create all these things. Maybe this should change
const nativeSources = makeProviders({
const providers = makeProviders({
fetcher: makeStandardFetcher(nodeFetch),
target: targets.NATIVE
}).listSources();
})
const browserSources = makeProviders({
fetcher: makeStandardFetcher(nodeFetch),
target: targets.BROWSER
}).listSources();
const sources = providers.listSources();
const embeds = providers.listEmbeds();
const nativeEmbeds = makeProviders({
fetcher: makeStandardFetcher(nodeFetch),
target: targets.NATIVE
}).listEmbeds();
const browserEmbeds = makeProviders({
fetcher: makeStandardFetcher(nodeFetch),
target: targets.BROWSER
}).listEmbeds();
const combined = [
...nativeSources, ...browserSources,
...nativeEmbeds, ...browserEmbeds
];
const combined = [...sources, ...embeds];
// * Remove dupes
const map = new Map(combined.map(source => [source.id, source]));