From 810e7c7b5a9f53bfaa25e6f05a277f6d23831cb4 Mon Sep 17 00:00:00 2001 From: sharpshark28 Date: Thu, 17 Aug 2017 18:01:46 -0500 Subject: [PATCH] Search works with any length of term --- index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 8f7b896..fc10490 100644 --- a/index.js +++ b/index.js @@ -26,14 +26,12 @@ module.exports = class Query { this.data = this.data.filter(item => item[key] === term); break; case 'string': - if (term.length >= 3) { - this.data = this.data.filter(item => { - let regFind = new RegExp(term, 'gi'); - let termMatches = (item[key].match(regFind) || []).length; - item.sortScore += termMatches; - return termMatches; - }); - } + this.data = this.data.filter(item => { + let regFind = new RegExp(term, 'gi'); + let termMatches = (item[key].match(regFind) || []).length; + item.sortScore += termMatches; + return termMatches; + }); break; } return this;