diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -252,8 +252,16 @@ function forSome(each) { function filterByText(str) { if (!str) return function () { return true } - var search = new RegExp(str, 'i') - var matches = forSome(search.test.bind(search)) + var matcher + try { + var search = new RegExp(str, 'i') + matcher = search.test.bind(search) + } catch(e) { + matcher = function (value) { + return String(value).indexOf(str) !== -1 + } + } + var matches = forSome(matcher) return function (msg) { var c = msg.value.content return c && matches(c) |