From b075fb5d710d2e780c9af9051fc932fccf0442e1 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Thu, 23 May 2019 12:51:18 +0530 Subject: [PATCH] fix: Compare number using contains instead of equals (#67) --- src/filterRows.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/filterRows.js b/src/filterRows.js index 5b058ea..1ed6f49 100644 --- a/src/filterRows.js +++ b/src/filterRows.js @@ -106,6 +106,16 @@ function getFilterMethod(filter) { return value >= values1[1] && value <= values2[1]; }) .map(cell => cell.rowIndex); + }, + + containsNumber(keyword, cells) { + return cells + .filter(cell => { + const hay = numberCompareValue(cell); + const needle = keyword; + return !needle || hay.toString().includes(needle); + }) + .map(cell => cell.rowIndex); } }; @@ -152,7 +162,7 @@ function guessFilter(keyword = '') { if (isNumber(compareString)) { return { - type: 'equals', + type: 'containsNumber', text: parseInt(keyword, 10) }; }