FIX: stop stripping "undefined" from fullpage search

This commit is contained in:
Sam 2017-11-13 17:26:02 +11:00
parent 281e430a89
commit cb14da4d90
1 changed files with 7 additions and 5 deletions

View File

@ -104,11 +104,13 @@ export default Ember.Controller.extend({
cleanTerm(term) {
if (term) {
SortOrders.forEach(order => {
let matches = term.match(new RegExp(`${order.term}\\b`));
if (matches) {
this.set('sortOrder', order.id);
term = term.replace(new RegExp(`${order.term}\\b`, 'g'), "");
term = term.trim();
if (order.term) {
let matches = term.match(new RegExp(`${order.term}\\b`));
if (matches) {
this.set('sortOrder', order.id);
term = term.replace(new RegExp(`${order.term}\\b`, 'g'), "");
term = term.trim();
}
}
});
}