diff --git a/lib/create-sort.js b/lib/create-sort.js index 88bcaa5..b4a6d2d 100644 --- a/lib/create-sort.js +++ b/lib/create-sort.js @@ -89,12 +89,14 @@ function _testQuery(doubleTestTrue, doubleTestFalse, singleTest) { * @return {boolean} */ return function (query) { - if (doubleTestTrue.test(query)) { - return true; - } else if (doubleTestFalse.test(query)) { - return false; - } - return singleTest.test(query); + let result; + + if (doubleTestTrue.test(query)) result = true; + else if (doubleTestFalse.test(query)) result = false; + else result = singleTest.test(query); + + /** Not keyword inverts the whole query */ + return query.includes('not') ? !result : result; }; }