fix for lint

jh-changes
Shin'ya Ueoka 7 years ago
parent 7ace5e1e19
commit bf8470e131
  1. 19
      src/background/histories.js

@ -10,7 +10,7 @@ const filterHttp = (items) => {
const filterEmptyTitle = (items) => { const filterEmptyTitle = (items) => {
return items.filter(item => item[0].title && item[0].title !== ''); return items.filter(item => item[0].title && item[0].title !== '');
} };
const reduceByPathname = (items, min) => { const reduceByPathname = (items, min) => {
let hash = {}; let hash = {};
@ -51,16 +51,17 @@ const getCompletions = (keyword) => {
return browser.history.search({ return browser.history.search({
text: keyword, text: keyword,
startTime: '1970-01-01' startTime: '1970-01-01'
}).then((items) => { }).then((historyItems) => {
items = items.map(item => [item, new URL(item.url)]); return [historyItems.map(item => [item, new URL(item.url)])]
items = filterEmptyTitle(items); .map(filterEmptyTitle)
items = filterHttp(items); .map(filterHttp)
items = reduceByPathname(items, 10); .map(items => reduceByPathname(items, 10))
items = reduceByOrigin(items, 10); .map(items => reduceByOrigin(items, 10))
return items .map(items => items
.sort((x, y) => x[0].visitCount < y[0].visitCount) .sort((x, y) => x[0].visitCount < y[0].visitCount)
.slice(0, 10) .slice(0, 10)
.map(item => item[0]); .map(item => item[0])
)[0];
}); });
}; };