new UI for search, closes #108 (still needs cleanup)

This commit is contained in:
azivner
2018-06-03 20:42:25 -04:00
parent 0f8f707acd
commit 76c0e5b2b8
8 changed files with 159 additions and 37 deletions

View File

@@ -79,6 +79,32 @@ function stripTags(text) {
return text.replace(/<(?:.|\n)*?>/gm, '');
}
function intersection(a, b) {
return a.filter(value => b.indexOf(value) !== -1);
}
function union(a, b) {
const obj = {};
for (let i = a.length-1; i >= 0; i--) {
obj[a[i]] = a[i];
}
for (let i = b.length-1; i >= 0; i--) {
obj[b[i]] = b[i];
}
const res = [];
for (const k in obj) {
if (obj.hasOwnProperty(k)) { // <-- optional
res.push(obj[k]);
}
}
return res;
}
module.exports = {
randomSecureToken,
randomString,
@@ -93,5 +119,7 @@ module.exports = {
stopWatch,
unescapeHtml,
toObject,
stripTags
stripTags,
intersection,
union
};