This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/src/background/shared/completions/bookmarks.js
2018-06-17 21:55:25 +09:00

14 lines
371 B
JavaScript

const getCompletions = async(keywords) => {
let items = await browser.bookmarks.search({ query: keywords });
return items.filter((item) => {
let url = undefined;
try {
url = new URL(item.url);
} catch (e) {
return false;
}
return item.type === 'bookmark' && url.protocol !== 'place:';
}).slice(0, 10);
};
export { getCompletions };