Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / lib / extension / utils / tabs.ts
blob9e070eb9d303c88bbb8bfd84dcfe00ec6bd529de
1 import browser from '@proton/pass/lib/globals/browser';
2 import type { TabId } from '@proton/pass/types';
3 import { truthy } from '@proton/pass/utils/fp/predicates';
5 export const filterDeletedTabIds = async (tabIds: TabId[]): Promise<TabId[]> =>
6     (
7         await Promise.all(
8             tabIds.map(async (tabId) => {
9                 try {
10                     const tab = await browser.tabs.get(tabId);
11                     if (!tab) return tabId;
12                 } catch (_) {
13                     return tabId;
14                 }
15             })
16         )
17     ).filter(truthy);