Rinser/plugins/filter_location.js

9 lines
344 B
JavaScript
Raw Normal View History

2016-08-17 14:36:28 +00:00
module.exports = function (item, itemOptions, source) {
2018-08-09 15:43:49 +00:00
const patt = /(glasgow|london|edinburgh)/ig;
const result = patt.test(itemOptions.description);
const resultB = patt.test(itemOptions.title);
console.log('Location:', (result || resultB === true) ? 'Pass' : 'Reject');
2016-08-17 14:36:28 +00:00
2018-08-09 15:43:49 +00:00
return (result || resultB === true) ? itemOptions : -1;
2016-08-17 14:36:28 +00:00
};