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-05-08 20:09:32 +09:00

15 lines
396 B
JavaScript

const getCompletions = (keywords) => {
return browser.bookmarks.search({ query: keywords }).then((items) => {
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 };