arch-wiki-man/lib/find.js
Gregory Scheerlinck 1673174a85 first commit
2016-01-30 15:11:55 +00:00

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() {
}