mirror of
https://github.com/greg-js/arch-wiki-man
synced 2024-11-15 12:12:45 +00:00
21 lines
407 B
JavaScript
21 lines
407 B
JavaScript
'use strict';
|
|
|
|
exports.narrowDown = narrowDown;
|
|
exports.select = select;
|
|
|
|
function narrowDown(articles, terms) {
|
|
var reSearchTerms = terms.map(function mapRE(term) {
|
|
return new RegExp(term, 'i');
|
|
});
|
|
|
|
return articles.filter(function filterOnTitle(article) {
|
|
return reSearchTerms.every(function checkRE(reTerm) {
|
|
return reTerm.test(article.title);
|
|
});
|
|
});
|
|
}
|
|
|
|
function select() {
|
|
|
|
}
|