aboutsummaryrefslogtreecommitdiff
path: root/src/background/shared/completions/tabs.js
blob: 8c0f1f9f3382d2f602e0db1323bafd650aa806dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
const getCompletions = (keyword, excludePinned) => {
  return browser.tabs.query({ currentWindow: true }).then((tabs) => {
    let matched = tabs.filter((t) => {
      return t.url.includes(keyword) || t.title && t.title.includes(keyword);
    }).filter((t) => {
      return !(excludePinned && t.pinned);
    });
    return matched;
  });
};

export { getCompletions };